Created
December 12, 2012 18:23
-
-
Save jef-n/4270244 to your computer and use it in GitHub Desktop.
ping apache
This file contains 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
#!/bin/bash | |
if [ -f /var/run/apache2.pid ]; then | |
if kill -0 $(</var/run/apache2.pid); then | |
if ! wget -q --timeout=10 --tries=1 -O /dev/null http://localhost; then | |
echo "apache running, but not responding" | |
ps auxwf | |
date | |
tail -20 /var/log/apache2/*.log | |
/etc/init.d/apache2 restart | |
sleep 20 | |
if ! wget -q --timeout=10 --tries=1 -O /dev/null http://localhost; then | |
echo "apache restarted, but still not responding" | |
else | |
echo "apache back up and responding" | |
fi | |
fi | |
else | |
echo "stale apache pid file found" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment