This is an FYI for those of you who manage servers, like I do.
During these times of heavy spam, we've been having issues with our Sendmail's anti-virus program getting killed and inhibiting mail delivery. This is caused by (a) the anti-virus (Sophos) processes all mail coming into port 25, if clean, it passes it through to Sendmail's port 2525 for delivery (incoming and outgoing) and (b) the sheer volume of spam and relay attempts has gotten pretty bad, lately, and it's been killing the anti-virus program when the spam attempts reach around 15-20 per second, effectively stopping mail delivery for our company.
While I prefer to use high availability software, like Heartbeat, this company only has one server, so server failover is not an option.
Instead, I wrote a little shell script (with help from various forums) that checks to see if the anti-virus daemon (mmsmtp2d) is running, and if it's not, to restart it. I run the script every 5 minutes as a cronjob. I could run it every minute ... but what the heck.
Here it is:
Code:
#!/bin/bash
if [ !"$(pidof mmsmtp2d)" ]
then
/usr/Sophos/MMSMTP2D/mmsmtp2 start
fi
Substitute the name of the process you want to monitor, and perhaps your choice of shell (I used bash because I have it on my Linux boxes). Of course, also modify the process startup command as required, like maybe:
Code:
#!/bin/bash
if [ !"$(pidof httpd)" ]
then
/etc/init.d/httpd start
fi
to make sure your Apache is always running.
I placed the script as "chkprocess.cgi" in my cgi-bin directory and set its attributes to rwxr-xr-x (755), just like the other cgi scripts in there, and I run it as root from cron.
Any questions? Lemme know. Enjoy!