19,610
社区成员
发帖
与我相关
我的任务
分享
# !/bin/sh
pidof mysqld >/dev/null
if [ $? -eq 0 ]
then
echo "running...">> ./mysql_log.txt
else
echo " mysql server was stopped">> ./mysql_log.txt
service mysql start
fi
*/2 * * * * /var/spool/cron/restart_mysql.sh
service crond restart
两分钟后去看 mysql_log.txt 是空的,
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed