Koozali.org: home of the SME Server

Legacy Forums => Experienced User Forum => Topic started by: Thomas on July 23, 2003, 05:14:14 PM

Title: Cron, Apache and a script
Post by: Thomas on July 23, 2003, 05:14:14 PM
Hi,

I'm using SME 5.6u4. Yesterday my Apache crashed for no apparent reason. I was able to restart it right away, as I was sitting right next to the machine when it happened.

But what If I had been away?

That got me thinking (I'm trying not to hurt myself): Could it be possible to make a script that checked if Apache is up and running, and the let Cron run that script every 5-10 minutes? If the script finds out Apache is either dead or crashed, then it does a apachectl restart.

What say all you SME wise people? Doable, or downright stupid?

Regards
Thomas
Title: Re: Cron, Apache and a script
Post by: Nathan Fowler on July 24, 2003, 02:19:28 AM
Easily done, however, instead of creating a band-aid, why not investigate as to why Apache is crashing to begin with.
Title: Re: Cron, Apache and a script
Post by: Thomas on July 24, 2003, 12:23:40 PM
Hello Nathan,

I'm sure Apache crashed due to some "system hiccup", since this server is only running pure and VERY simple HTML. I haven't been able to find anything odd in the logs either.

So this band-aid will be for those very rare situations where Apache just decides to shut down for no apparent reason.

Sincerely,
Thomas
Title: Re: Cron, Apache and a script
Post by: Nathan Fowler on July 24, 2003, 06:37:51 PM
Sounds like a winner to me:

Script you'll want to use is:
http://www.stickit.nu/utils/apachemon.pl

It's a perl script that runs in an infinite loop, you won't want to cron this, but rather add it to /etc/rc.d/rc.local