#!/bin/sh
pidof mysqld >/dev/null
if [ $? -eq 0 ]
then
echo "It is running."
else
echo "At `date` MySQL Server was stopped">> /home/mysql_log
service mysql start
fi
cron -e 編輯 cron
* * * * * /home/你的.sh檔位置
#!/bin/sh
pidof mysqld >/dev/null
if [ $? -eq 0 ]
then
echo "It is running."
else
echo "At `date` MySQL Server was stopped">> /home/mysql_log
service mysql start
fi
cron -e 編輯 cron
* * * * * /home/你的.sh檔位置