From 601e0bb5db20e5aa12cfeb3ddb3cf4f885a91370 Mon Sep 17 00:00:00 2001 From: Matt McKinnon Date: Tue, 7 Jun 2016 20:51:02 +1000 Subject: [PATCH] Updated formatting mailQWatch.sh --- mailQWatch.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mailQWatch.sh b/mailQWatch.sh index 794adba..f9cf7f3 100755 --- a/mailQWatch.sh +++ b/mailQWatch.sh @@ -4,18 +4,18 @@ # Date: 7th June 2016 # Description: # This script will email a report mailq on postfix is high. - -QUEUELIMIT=75 -SUBJECT="Mail Queue on $HOST is currently $QUEUECOUNT" -MAILTO="support@comprofix.com" - -HOST=$(/bin/hostname) -POSTQUEUE=$(which postqueue) -QUEUELENGTH=$($POSTQUEUE -p | tail -n1 | awk '{print $5}') -QUEUECOUNT=$(echo $QUEUELENGTH | grep "[0-9]") - + +QUEUELIMIT=75 +SUBJECT="Mail Queue on $HOST is currently $QUEUECOUNT" +MAILTO="support@comprofix.com" + +HOST=$(/bin/hostname) +POSTQUEUE=$(which postqueue) +QUEUELENGTH=$($POSTQUEUE -p | tail -n1 | awk '{print $5}') +QUEUECOUNT=$(echo $QUEUELENGTH | grep "[0-9]") + if [ "$QUEUECOUNT" == "" ]; then exit; elif [ "$QUEUECOUNT" -gt "$QUEUELIMIT" ]; then - $POSTQUEUE -p | /bin/mail -s "$SUBJECT" "$MAILTO" + $POSTQUEUE -p | /bin/mail -s "$SUBJECT" "$MAILTO" fi