mirror of
https://github.com/deajan/obackup.git
synced 2024-12-26 23:43:42 +01:00
More clear subject line in alerts
This commit is contained in:
parent
e966682ecc
commit
d1c845ba67
@ -1,6 +1,6 @@
|
|||||||
#### MINIMAL-FUNCTION-SET BEGIN ####
|
#### MINIMAL-FUNCTION-SET BEGIN ####
|
||||||
|
|
||||||
## FUNC_BUILD=2016082301
|
## FUNC_BUILD=2016082601
|
||||||
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||||
@ -220,6 +220,8 @@ function KillAllChilds {
|
|||||||
|
|
||||||
# osync/obackup/pmocr script specific mail alert function, use SendEmail function for generic mail sending
|
# osync/obackup/pmocr script specific mail alert function, use SendEmail function for generic mail sending
|
||||||
function SendAlert {
|
function SendAlert {
|
||||||
|
local runAlert="${1:-false}" # Specifies if current message is sent while running or at the end of a run
|
||||||
|
|
||||||
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
local mail_no_attachment=
|
local mail_no_attachment=
|
||||||
@ -253,6 +255,7 @@ function SendAlert {
|
|||||||
else
|
else
|
||||||
mail_no_attachment=0
|
mail_no_attachment=0
|
||||||
fi
|
fi
|
||||||
|
#TODO(low): Change tail -n 50 to end of fil up to last script begin
|
||||||
MAIL_ALERT_MSG="$MAIL_ALERT_MSG"$'\n\n'$(tail -n 50 "$LOG_FILE")
|
MAIL_ALERT_MSG="$MAIL_ALERT_MSG"$'\n\n'$(tail -n 50 "$LOG_FILE")
|
||||||
if [ $ERROR_ALERT -eq 1 ]; then
|
if [ $ERROR_ALERT -eq 1 ]; then
|
||||||
subject="Error alert for $INSTANCE_ID"
|
subject="Error alert for $INSTANCE_ID"
|
||||||
@ -262,6 +265,12 @@ function SendAlert {
|
|||||||
subject="Alert for $INSTANCE_ID"
|
subject="Alert for $INSTANCE_ID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ runAlert == true ]; then
|
||||||
|
subject="Current run $subject"
|
||||||
|
else
|
||||||
|
subject="Fnished run Final $subject"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$mail_no_attachment" -eq 0 ]; then
|
if [ "$mail_no_attachment" -eq 0 ]; then
|
||||||
attachment_command="-a $ALERT_LOG_FILE"
|
attachment_command="-a $ALERT_LOG_FILE"
|
||||||
fi
|
fi
|
||||||
@ -620,7 +629,7 @@ function WaitForTaskCompletion {
|
|||||||
if [ $soft_alert -eq 0 ] && [ $soft_max_time -ne 0 ]; then
|
if [ $soft_alert -eq 0 ] && [ $soft_max_time -ne 0 ]; then
|
||||||
Logger "Max soft execution time exceeded for task [$caller_name] with pids [$(joinString , ${pidsArray[@]})]." "WARN"
|
Logger "Max soft execution time exceeded for task [$caller_name] with pids [$(joinString , ${pidsArray[@]})]." "WARN"
|
||||||
soft_alert=1
|
soft_alert=1
|
||||||
SendAlert
|
SendAlert true
|
||||||
|
|
||||||
fi
|
fi
|
||||||
if [ $exec_time -gt $hard_max_time ] && [ $hard_max_time -ne 0 ]; then
|
if [ $exec_time -gt $hard_max_time ] && [ $hard_max_time -ne 0 ]; then
|
||||||
@ -633,7 +642,7 @@ function WaitForTaskCompletion {
|
|||||||
Logger "Could not stop task with pid [$pid]." "ERROR"
|
Logger "Could not stop task with pid [$pid]." "ERROR"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
SendAlert
|
SendAlert true
|
||||||
errrorcount=$((errorcount+1))
|
errrorcount=$((errorcount+1))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user