Web Hosting Talk







View Full Version : respawning apache


clocker1996
01-30-2002, 05:29 PM
Are there any scripts out ther where you run it in the backround and it'll check every minute if apache is down
and if it is it'll run /www/bin/apachectl start

Does anyone have a script like this or knows where i can get one?

priyadi
01-31-2002, 02:49 AM
Stick this into your crontab, I have one like this but for BIND :D


ps auwx | grep -v grep | grep httpd || /www/bin/apachectl start

goodness0001
01-31-2002, 04:45 PM
so basically all this does is see if any httpd instances are running and if they are not it tries to start apache...

priyadi
02-01-2002, 08:02 AM
Yes, it won't work if there is more than one instance of Apache running. For that, the test must be replaced by something like wget.

Jackmaninov
02-01-2002, 09:28 PM
Should init be doing this sort of polling anyways?

priyadi
02-02-2002, 03:23 AM
Originally posted by Jackmaninov
Should init be doing this sort of polling anyways?

Yes, but it doesn't, unfortunately. Some 'inits' do this however, like daemontools' supervise.