Centos 7 使用Shell脚本定时检查MySql服务运行状态

MySQL监控脚本:

#!/bin/bash
pgrep mysqld &> /dev/null
if [ $? -gt 0 ]
then
echo "`date` ERROR! MySQL is not running" >> /home/mysqlstatus.log
systemctl start mysqld >> /home/mysqlstatus.log
else
echo "`date` SUCCESS! MySQL running" >> /home/mysqlstatus.log
fi

继续阅读“Centos 7 使用Shell脚本定时检查MySql服务运行状态”