23 lines
799 B
PowerShell
23 lines
799 B
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
$env:PILOT_SSH_TARGET = 'krona-home'
|
|
$env:PILOT_REMOTE_BACKUP_DIRECTORY = '/home/ochenstarik/krona-staff-pilot/backups'
|
|
$env:BACKUP_LOCAL_DIRECTORY = '/c/Users/trush/Documents/KronaStaffBackups'
|
|
$env:BACKUP_MAX_AGE_HOURS = '36'
|
|
|
|
$taskBash = 'C:\Program Files\Git\bin\bash.exe'
|
|
$taskPull = Join-Path $PSScriptRoot 'pull-pilot-backups.sh'
|
|
$taskLog = 'C:\Users\trush\Documents\KronaStaffBackups\pull.log'
|
|
|
|
try {
|
|
$taskResult = & $taskBash $taskPull 2>&1
|
|
$taskExit = $LASTEXITCODE
|
|
$taskResult | Out-File -LiteralPath $taskLog -Append -Encoding utf8
|
|
if ($taskExit -ne 0) {
|
|
throw "Backup pull failed with exit code $taskExit"
|
|
}
|
|
} catch {
|
|
"$(Get-Date -Format o) $($_.Exception.Message)" |
|
|
Out-File -LiteralPath $taskLog -Append -Encoding utf8
|
|
exit 1
|
|
}
|