adding msmtp-queue-handler depending on off/on status; make msmtp-queue paths configurable; reset counter when queue=0

This commit is contained in:
2016-11-23 12:44:29 +01:00
parent 42e41f3968
commit 3e0ec4d05a
4 changed files with 28 additions and 4 deletions

View File

@@ -17,13 +17,15 @@ function isonline {
# NUMBER OF UNSENT EMAILS
function check_mailqueue {
QUEUE=$(msmtp-listqueue.sh | grep -o "^From: " | wc -l)
QUEUE=$($MSMTP_LIST | grep -o "^From: " | wc -l)
OUT="$OUT;mq=$QUEUE"
TOOL="$TOOL;conn=$var_conn"
# If $QUEUE > 0 and >10 runs, show notification
if [ "$QUEUE" -gt 0 ]; then
var_mailqueue_runs=$(($var_mailqueue_runs + 1))
else
var_mailqueue_runs=0 # reset counter if queue is empty again
fi
if [ "$QUEUE" -gt 0 ] && [ "$var_mailqueue_runs" -gt 9 ]; then
notify-send "There are mails in the mailqueue. Remember sending them manually or switch online status."