Simple Email Queue Alert Shell Script on Linux
July 21 2015
Email alert is one of the important to know number of Email's in queue, the following script send an email alert more than 100 email in queue,
#Email queue Notification ,
#!/bin/sh
#Email Queue:
MQUEUE=`find /var/spool/exim/input -name '*-H'|wc -l| sed -e "s/ //g"`
EMAIL_ID="your_email@gmail.com"
if [ $MAIL_QUEUE -gt 100 ]; then
echo "EMAIL QUEUE SENDING MORE THAN 100= $MAILQUEUE" | mail -s "Email queue Alert:"$EMAIL_ID
else
exit
fi
Another way is,
#Email queue Notification
#!/bin/sh
MAIL_QUEUE=`exim -bpc`
EMAIL_ID="your_email@gmail.com"
if [ $MAIL_QUEUE -gt 100 ]; then
echo "EMAIL QUEUE SENDING MORE THAN 100= $MAIL_QUEUE" | mail -s "Email queue Alert:"$EMAIL_ID
else
exit
fi
Comments (0)