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 $EMAILCHK_FILENAME.sh
Then add a Cron for it to run and check, say every (15) minutes:
crontab -e */15 * * * * bash /path/to/your/file.sh