Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Need Apache Monitor Script

Need Apache Monitor Script
Thread Tools
Junior Member
Join Date: Feb 2001
Status: Offline
Reply With Quote
Oct 1, 2003, 08:00 PM
 
I just set up an Xserve with A LOT of virtual hosts and A LOT of traffic. I'm running Apache 2.0.47, but the httpd process keeps crashing. I need a shell script that can run periodically to determine if Apache is running or not. If it's NOT, it should be started.

I'm trying to determine the root of the crashing problem, but I thought a script like this could help me get some sleep in the meantime.

Any suggestions?
     
Dedicated MacNNer
Join Date: May 2003
Location: Santa Barbara
Status: Offline
Reply With Quote
Oct 2, 2003, 02:09 AM
 
cronjob

Code:
*/5 * * * * /var/root/apache-restart.sh 2>&1 >/dev/null
apache-restart.sh

Code:
#!/bin/sh if [ `ps ax | grep httpd | grep -v grep | wc -l` -eq 0 ] then date=`date` echo "Apache restarted at $date" | mail -s "Apache restarted" you@youraddress.com /usr/sbin/apachectl start fi
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:51 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2