mail_wrap_script.sh: add error code to mail output

This commit is contained in:
Alice Gaudon 2020-01-29 05:20:35 +01:00
parent 7c0b8bae26
commit 1d6c448599

View File

@ -18,7 +18,7 @@ rm /tmp/$FILE_ID.log
if [ $ERR -ne 0 ]; then
MAILTO=$(cat "$HOME/.admin_mail")
echo "Sending error mail"
echo -e "An error occured during the execution of $SCRIPT.\n\n$OUTPUT" | mailx -s "$(hostname) $SCRIPT failure" "$MAILTO"
echo -e "An error occured during the execution of $SCRIPT ($ERR).\n\n$OUTPUT" | mailx -s "$(hostname) $SCRIPT failure" "$MAILTO"
echo "Sent"
exit 1
fi