Exim is a mail transfer agent mainly used in cPanel and DirectAdmin servers.
Nowadays spamming is a common issue and an Exim Mail queue monitoring
Script will help you to find these kinds of problems in the beginning
itself.
First, you need to create a script file, say “mailqueue.sh”
Read more about VI editor
here.
Add the following script to the above file.
- #!/bin/bash
- NUM=`/usr/sbin/exim -bpc`
- if [ $NUM -gt 100 ]
- then echo "Current Email Queue size is $NUM" | /bin/mail -s "Email Queue Critical on $HOSTNAME" [email protected]
- fi
Please replace
[email protected] with the desired email address.
Give excecution permission
Run this script after certain period using cronjobs.
- 0 * * * * /bin/sh /root/mailqueue.sh >/dev/null 2>&1
This cronjob runs every hour.