Quantcast
Channel: Scripts – Linux – e-diary
Viewing all articles
Browse latest Browse all 11

Cpanel email queue notification script.

$
0
0

Create a file called mailqueue.sh.


 vim /root/mailqueue.sh


 Add the following code.



#!/bin/bash


EMAIL=”youraddress@mail.com”


MQUEUE=`find /var/spool/exim/input -name ‘*-H’ | wc -l | sed -e “s/ //g”`


if [ $MQUEUE -gt 200 ]; then
echo “Mail queue at `hostname` has $MQUEUE messages!!!” | mail -s “CRITICAL ALERT: Mail queue” $EMAIL
fi

  
 Save the file and schedule a cronjob to execute the file on every minute.


     # crontab -e

and set the following cronjob


       * * *  *  *  /bin/sh /root/mailqueue.sh

 

The post Cpanel email queue notification script. appeared first on Linux - e-diary.


Viewing all articles
Browse latest Browse all 11

Trending Articles