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:
+19
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user