Recently we had been facing critical alert on our Sendmail MTA performance delay/socket time out. By looking into thie mail queue we could see that there were large count of Mailer-Deamon causing the queue delivery delay on other genuine mails. The issue got fixed by deleting these mails from the queue by running one simple script. I am pasting that script here you can make neccessary changes if you need. I hope it might help you too.
[root@server3 root]# cat /scripts/deleteMLRDM.sh
#!/bin/bash
#Delete SendMail MAILER-DAEMON
#set -x -> uncomment to debug the script
### Specify your Sendmail Path
SENDMAIL=”/usr/sbin/sendmail”
## Specify Queue Directory Path
MQUEUE=”/home/virtual/FILESYSTEMTEMPLATE/services/sendmail/mqueue”
## Specify mail admin
MAIL=”sysadmins@yourdomain.com”
MCOUNT=$($SENDMAIL -bp |grep MAILER-DAEMON -c)
delete(){
if [ $MCOUNT -gt 5 ] ;then
{
for i in `$SENDMAIL -bp |grep MAILER-DAEMON |awk -F” ” ‘{print $1}’|sed -e ‘s_\*$__gi’`
do rm -vf “$MQUEUE”/*”$i” ;done
#Do restart Program, Specify the Vscript path or your Usual method
/etc/init.d/sendmail restart
}
fi
return
}
delete > /tmp/MLDRtmp.logs
[ -s /tmp/MLDRtmp.logs ] && cat /tmp/MLDRtmp.logs |mail -s ” $MCOUNT MAILER-DAEMON Have been removed. Check with Logs” $MAIL
rm -f /tmp/MLDRtmp.logs
You can setup cronjob to execute this script periodically.
-LINsider
-rIyas
Good one