Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Ezilon Directory   I Sell Pagerank   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 04-10-2007, 12:39 PM   #1 (permalink)
Inactive
 
StupidScript's Avatar
 
Join Date: 09-22-06
Location: Los Angeles
Posts: 678
iTrader: 0 / 0%
Latest Blog:
None

StupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really nice
CGI: Server: Detect Stopped Process and Revive

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!
StupidScript is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 04-10-2007, 01:33 PM   #2 (permalink)
Inactive
 
StupidScript's Avatar
 
Join Date: 09-22-06
Location: Los Angeles
Posts: 678
iTrader: 0 / 0%
Latest Blog:
None

StupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really nice
Oop. Cron runs a little differently than executing from the command line does, so you'll want to specify the whole path to the pidof binary:
Code:
#!/bin/bash if [ !"$(/sbin/pidof httpd)" ] then /etc/init.d/httpd start fi
Sorry!
StupidScript is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-12-2007, 03:15 PM   #3 (permalink)
Contributing Member
 
exam's Avatar
 
Join Date: 04-20-06
Posts: 310
iTrader: 0 / 0%
Latest Blog:
None

exam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web pro
Thanks, I've filed this away for a rainy day when I might need it!
exam is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto-Detect Visitor's Speed??? incakola Web Design Lobby 4 11-03-2007 06:45 AM
how to detect clicks on links opened in a new tab in Firefox poster Coding Forum 6 01-30-2007 09:36 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 07:46 PM.
© Copyright 2008 V7 Inc