Scripting

Exim Mail queue monitoring Script

Exim Mail Queue
Exim Mail Queue

Exim Mail queue monitoring Script

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”

vim 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" user@youremail.com 
fi

Please replace user@youremail.com with the desired email address.

Give excecution permission

chmod +x mailqueue.sh

Run this script after certain period using cronjobs.

0 * * * * /bin/sh /root/mailqueue.sh >/dev/null 2>&1

This cronjob runs every hour.

That’s it!

If you like this post and wish to receive more articles from us, please like our FB page: Button

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at info@grepitout.com

Add Comment

Click here to post a comment

Topics