retry error messaging improvements

This commit is contained in:
Kevin Woley
2020-04-30 09:49:49 -07:00
parent 7cff028471
commit 63a8bb9218
+10 -3
View File
@@ -322,13 +322,20 @@ function Invoke-Main {
Write-Warning "Errors found! Error Log: $error_log" Write-Warning "Errors found! Error Log: $error_log"
$error_count++ $error_count++
Write-Output "Something went wrong. Sleeping for 15 min and then retrying..." | Tee-Object -Append $success_log $attempt_count--
if($attempt_count -gt 0) {
Write-Output "Sleeping for 15 min and then retrying..." | Tee-Object -Append $success_log
}
else {
Write-Output "Retry limit has been reached. No more attempts to backup will be made." | Tee-Object -Append $success_log
}
if($internet_available -eq $true) { if($internet_available -eq $true) {
Invoke-HistoryCheck $success_log $error_log Invoke-HistoryCheck $success_log $error_log
Send-Email $success_log $error_log Send-Email $success_log $error_log
} }
Start-Sleep (15*60) if($attempt_count -gt 0) {
$attempt_count-- Start-Sleep (15*60)
}
} }
Set-BackupState Set-BackupState