add custom actions configuration to enable invoking scripts other commands on script start and end. Defined by $CustomAction* config variables.

This commit is contained in:
Kevin Woley
2025-02-08 00:29:06 -08:00
parent 7c0111308a
commit eaf97cd2d7
2 changed files with 29 additions and 1 deletions
+19
View File
@@ -546,6 +546,11 @@ function Invoke-Main {
exit 1
}
# custom start action
if($null -ne $CustomActionStart) {
Invoke-Expression $CustomActionStart
}
$error_count = 0
$backup_success = $false
$maintenance_success = $false
@@ -671,6 +676,20 @@ function Invoke-Main {
}
}
# custom end actions
if((-not $backup_success) -or ($maintenance_needed -and -not $maintenance_success)) {
# call the custom error action if backup failed and/or maintenance was needed and failed
if($null -ne $CustomActionEndError) {
Invoke-Expression $CustomActionEndError
}
}
else {
# call custom success action if backup & maintenance were successful
if($null -ne $CustomActionEndSuccess) {
Invoke-Expression $CustomActionEndSuccess
}
}
# Save state to file
Set-BackupState