Skip to content

Instantly share code, notes, and snippets.

@meise
Created May 29, 2014 22:00
Show Gist options
  • Save meise/d20397d4db5c7e7b081e to your computer and use it in GitHub Desktop.
Save meise/d20397d4db5c7e7b081e to your computer and use it in GitHub Desktop.
Check qmail mesaagequeue status
#!/bin/sh
MAIL_BIN=`command -v mail`
QMAIL_QUEUE_SIZE=`/var/qmail/bin/qmail-qstat | grep 'messages in queue:' | awk '{print $NF}'`
function send_notification_mail() {
$MAIL_BIN -s "WARNING: MAILQ critical on $HOSTNAME - size $QMAIL_QUEUE_SIZE" "todesadmin@example.tdl" <<EOF
Messages in queue: $QMAIL_QUEUE_SIZE
EOF
}
if [ "$QMAIL_QUEUE_SIZE" -gt "100" ]; then
send_notification_mail
fi
exit 0
*/10 * * * * /usr/local/bin/qstat_cron_check 1> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment