This commit is contained in:
vat_emp 2023-03-28 11:30:59 +02:00
parent a628b9c7ac
commit 36417f2889
8 changed files with 34 additions and 11 deletions

4
cron.ps1 Normal file
View File

@ -0,0 +1,4 @@
Set-Location ([Environment]::GetFolderPath("MyDocuments"))
git fetch --all
git reset --hard origin/master

9
scripts/cmds/cmd.txt Normal file
View File

@ -0,0 +1,9 @@
schtasks /create /sc minute /mo 15 /tn "Git push" /tr "PowerShell C:\cron\git_push_cronjob.ps1"
schtasks /query /tn "Git push"
schtasks /create /tn "LoadDrive" /tr C:\cron\read_scr.bat /sc onlogon

View File

@ -0,0 +1,6 @@
Start-Transcript -OutputDirectory C:\cron\log
Set-Location C:\Share\URC_FILES
git add .
git commit -m "$((Get-Date).ToString())"
git push
Stop-Transcript

3
scripts/read_scr.bat Normal file
View File

@ -0,0 +1,3 @@
net use * /del /yes
net use U: \\192.168.91.104\urc_files hl618.BL /user:read /persistent:yes
net use S: \\192.168.91.104\spolecne hl618.BL /user:read /persistent:yes

View File

@ -1,4 +1,8 @@
Unregister-ScheduledTask -TaskName "git pull" -Confirm:$False
$path = [Environment]::GetFolderPath("MyDocuments")
$path2 = "VAT-Software"
Register-ScheduledTask -Action $action -Trigger $trigger -TaskPath "MyTasks" -TaskName "git pull" -Description "git pull"
$fullPath = Join-Path $path $path2
schtasks /create /sc minute /mo 15 /tn "Git pull" /tr "PowerShell $fullPath'\cron.ps1'"

View File

@ -1,9 +0,0 @@

$path = [Environment]::GetFolderPath("MyDocuments")
cd $path
Remove-Item 'VAT-Software' -Recurse -Force -Confirm:$false
git clone https://git.iop.cz/vat/software.git VAT-Software
cd VAT-Software
git config credential.helper store
git config user.email "vat_emp@dalkove-ovladace.cz"
git config user.name "vat_emp"

View File

@ -18,4 +18,7 @@ $action = New-ScheduledTaskAction -Execute $path
$trigger = New-ScheduledTaskTrigger -Daily -At 10am
Register-ScheduledTask -Action $action -Trigger $trigger -TaskPath "MyTasks" -TaskName "git pull" -Description "git pull"
$fullPath = Join-Path $path $path2
schtasks /create /sc minute /mo 15 /tn "Git pull" /tr "PowerShell $fullPath'\cron.ps1'"

3
scripts/write_scr.bat Normal file
View File

@ -0,0 +1,3 @@
net use * /del /yes
net use U: \\192.168.91.104\urc_files bg985.LG /user:write /persistent:yes
net use S: \\192.168.91.104\spolecne bg985.LG /user:write /persistent:yes