commit 237277121c659af34e771c36cd2c49561048e656
parent 87aafff0df4fff512e8d376919d42c5a57faac53
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Sat, 23 Nov 2019 17:25:13 +0100
test sendmail return status
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/poll.sh b/poll.sh
@@ -41,9 +41,16 @@ CDATEA=$(($CDATE + 300))
mkdir -p sent sent_reminders scheduled_reminders
+ # note: we may overwrite a file here
+ # in case it's not the first time we try to send the reminder
prepare_email_forward "$EMAIL" "$EMAIL" "PING: $SUBJECT: $EXPL" "$MESSAGEID" "$FILE" "$EXPL" \
> "scheduled_reminders/$FILENAME"
sendmail -t < "scheduled_reminders/$FILENAME"
+ if [ $? -ne 0 ]
+ then
+ echo "sendmail failed for $FILENAME"
+ exit 1
+ fi
mv "scheduled_reminders/$FILENAME" "sent_reminders/$FILENAME"
mv "scheduled/$FILENAME" "sent/$FILENAME"