May 10 2013
Shell script to restart apache and mysql when fall.
This script restart your apache or mysql if necessary.
Anyway, you need a crontab to running this script.
I use so.
Crontab
* * * * * sh /var/www/restart.sh.
Shell
RESTART="apachectl restart"
PGREP="/usr/bin/pgrep"
HTTPD="apache"
$PGREP ${HTTPD}
if [ $? -ne 0 ]
then
$RESTART
fi
RESTARTM="service mysql restart"
MYSQLD="mysqld"
$PGREP ${MYSQLD}
if [ $? -ne 0 ]
then
$RESTARTM
fi




