Koozali.org: home of the SME Server

Cron, Apache and a script

Thomas

Cron, Apache and a script
« 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

Nathan Fowler

Re: Cron, Apache and a script
« Reply #1 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.

Thomas

Re: Cron, Apache and a script
« Reply #2 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

Nathan Fowler

Re: Cron, Apache and a script
« Reply #3 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