Bash Script To Monitor Exim Queue & Email If Queue Goes Over Threshold

This is a very simple script used to monitor the Exim Queue and Email an address when the threshold is breached.

First, create the file, changing $THRESHOLD to a number of Emails you want the cutoff to be at, and $ADDRESS, which is the Email address you want to send to:

if [ `exim -bpc` -ge $THRESHOLD ]; then mail -s "Alert: There are over $THRESHOLD Emails in the queue!" $ADDRESS <<EOF Your Exim Queue is over the alert threshold set. EOF fi

Make sure you make the file executable when you are finished:

chmod +x $

Then add a Cron for it to run and check, say every (15) minutes:

crontab -e */15 * * * * bash /path/to/your/ 



I am a g33k, Linux blogger, developer, student and Tech Writer for My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.