Web Hosting Talk







View Full Version : Apache Automatic Restart


blacknight
04-10-2002, 05:10 AM
I know I saw something about this a couple of weeks ago, but I just can't find it!

Basically Apache kills itself every now and again. I'm not too sure why, but as I have to sleep sometimes I don't usually find out for a couple of hours.

I would like to be able to check using crontab every 5 minutes (or less) if apache is running and if it isn't too restart it. I know this isn't too complicated, but I'd probably make a mess of it!

Any ideas?

Jake29
04-10-2002, 07:06 AM
You might want to chech out Daemontools: http://cr.yp.to/daemontools.html .

Jake

priyadi
04-10-2002, 08:10 AM
It is probably not easy to run apache with daemontools.

If you want crontab solution try something like this in your crontab:

ps auwx | grep httpd || service httpd start

blacknight
04-10-2002, 01:49 PM
Originally posted by priyadi
It is probably not easy to run apache with daemontools.

If you want crontab solution try something like this in your crontab:

ps auwx | grep httpd || service httpd start
What exactly will that do?

taz0
04-10-2002, 02:35 PM
Originally posted by blacknight

What exactly will that do?

List the processes, check if httpd is there,
restart if not. It's not the actual code however.

blacknight
04-10-2002, 02:42 PM
Thanks. I'm using a RAQ4, so I think the 'service' option might not work - or maybe I'm mistaken.
If anybody has a code snippet that does this I would really appreciate it, as Apache has a habit of killing itself from time to time...

Anybody?