Created
August 18, 2012 07:26
-
-
Save Amitesh/3385033 to your computer and use it in GitHub Desktop.
Apache cron watch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#apache-cron-watcher.sh | |
#!/bin/sh | |
run=`ps ax | grep /usr/sbin/apache2 | grep -v grep | cut -c1-5 | paste -s -` | |
if [ "$run" ]; | |
then | |
echo “Apache is running” | |
else | |
echo "Apache not running" | |
/etc/init.d/apache2 restart | |
fi | |
# Crontab settings | |
# m h dom mon dow command | |
# check on each 5 minutes | |
*/5 * * * * /home/user/apache-cron-watcher.sh > /dev/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment