serverscripts/mailQWatch.sh
Matthew McKinnon 2cda37ccc8 Updated script descriptions
Updated email address in scripts
Removed squidguard-blacklists.sh
2016-06-07 20:42:19 +10:00

22 lines
575 B
Bash
Executable File

#!/bin/bash
# Script Name: mailQWatch
# Author: Matt McKinnon
# 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]")
if [ "$QUEUECOUNT" == "" ]; then
exit;
elif [ "$QUEUECOUNT" -gt "$QUEUELIMIT" ]; then
$POSTQUEUE -p | /bin/mail -s "$SUBJECT" "$MAILTO"
fi