From e32c555f5919722a58a92f851eaae1b8c4c59f17 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Fri, 8 Jan 2021 15:04:39 +0100 Subject: [PATCH] mail_wrap_script.sh: don't put failure in subject when it is not a failure --- mail_wrap_script.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mail_wrap_script.sh b/mail_wrap_script.sh index dad022d..77e79cd 100755 --- a/mail_wrap_script.sh +++ b/mail_wrap_script.sh @@ -54,9 +54,13 @@ OUTPUT=$(cat /tmp/$FILE_ID.log) rm /tmp/$FILE_ID.log # Send mail in case of error -if [ $ALWAYS_SEND -ne 0 ] || [ $ERR -ne 0 ] && [ "$ERR" != "$IGNORE_EXIT_CODE" ]; then +if [ $ERR -ne 0 ] && [ "$ERR" != "$IGNORE_EXIT_CODE" ]; then echo "Sending error mail" echo -e "An error occured during the execution of $SCRIPT ($ERR).\n\n\n$(ps $PPID)\n\n$OUTPUT" | $(dirname $0)/mail.sh "$(hostname) $SCRIPT failure" echo "Sent" exit 1 +elif [ $ALWAYS_SEND -ne 0 ]; then + echo "Sending log mail" + echo -e "Logging execution of $SCRIPT ($ERR).\n\n\n$(ps $PPID)\n\n$OUTPUT" | $(dirname $0)/mail.sh "$(hostname) $SCRIPT log" + echo "Sent" fi