1
0
mirror of https://github.com/deajan/obackup.git synced 2026-02-05 22:55:14 +01:00

Added an option to run after exec cmd on error

This commit is contained in:
deajan
2016-04-06 20:47:04 +02:00
parent 9d057ea95f
commit 15d3d98164
5 changed files with 39 additions and 4 deletions

View File

@@ -1085,15 +1085,24 @@ function TrapQuit {
if [ $ERROR_ALERT -ne 0 ]; then
SendAlert
if [ "$RUN_AFTER_CMD_ON_ERROR" == "yes" ]; then
RunAfterHook
fi
CleanUp
Logger "Backup script finished with errors." "ERROR"
exitcode=1
elif [ $WARN_ALERT -ne 0 ]; then
SendAlert
if [ "$RUN_AFTER_CMD_ON_ERROR" == "yes" ]; then
RunAfterHook
fi
CleanUp
Logger "Backup script finished with warnings." "WARN"
exitcode=2
else
if [ "$RUN_AFTER_CMD_ON_ERROR" == "yes" ]; then
RunAfterHook
fi
CleanUp
Logger "Backup script finshed." "NOTICE"
exitcode=0

View File

@@ -36,15 +36,24 @@ function TrapQuit {
if [ $ERROR_ALERT -ne 0 ]; then
SendAlert
if [ "$RUN_AFTER_CMD_ON_ERROR" == "yes" ]; then
RunAfterHook
fi
CleanUp
Logger "Backup script finished with errors." "ERROR"
exitcode=1
elif [ $WARN_ALERT -ne 0 ]; then
SendAlert
if [ "$RUN_AFTER_CMD_ON_ERROR" == "yes" ]; then
RunAfterHook
fi
CleanUp
Logger "Backup script finished with warnings." "WARN"
exitcode=2
else
if [ "$RUN_AFTER_CMD_ON_ERROR" == "yes" ]; then
RunAfterHook
fi
CleanUp
Logger "Backup script finshed." "NOTICE"
exitcode=0