e=`/bin/ps aux | grep -c "mysqld$"` if [ $e -ne 1 ]; then ehco "AT time: `date` : mysql server is down, restart it." >> /root/mysql_mon/mysql_mon.log /usr/sbin/service apache2 restart /usr/sbin/service mysql restart fi 保存为文件/root/mysql_mon/mysql_mon.sh退出