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