/mysql_monitor.sh
#!/bin/bash
pgrep -x mysqld &> /dev/null
if [ $? -ne 0 ]
then
echo "At time: `date` :MySQL is stop .">> /mysql_listen.log
/sbin/service mysqld restart
else
echo "At time: `date` :MySQL server is running .">> /mysql_listen.log
fi

计划任务
crontab -e
*/5 * * * * /mysql_monitor.sh


*/5 * * * * /usr/bin/php /html/rjob.php