Apache

Shell script to check Apache status

You’ll need a cron task that will check whether apache is up and will restart it if not.

You’ll need a simple shell script and here it is:

    #!/bin/sh
    run=`ps ax | grep /usr/sbin/httpd | grep -v grep | cut -c1-5 | paste -s -`
    if [ "$run" ];
    then
    echo “Apache is running”
    else
    /etc/init.d/httpd start
    fi

This script will check for a number of running script processes and will try to start apache if it is not running. You should add this script to crontab with any frequency you like. I’d suggest to run it every 3 minutes as it doesn’t cause server load, but your apache stability is vital.

 
/home/dodgydevil/wiki.zendfusion.com/data/pages/other/linux/apache.txt · Last modified: 2009/10/08 23:07 by bosbaba
[unknown button type]
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Zend Fusion