There was a problem loading the comments.

Exim Mail queue monitoring Script

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
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.

Share via

Related Articles

Copyright © 2021 TheGigabit. All right reserved. Reg.No: 200701034297 (792326-P)