目录
html
一、确保crond服务正常运行bash
编写自动重启脚本spa
一、定时重启脚本.net
二、设置开机启动
rest
#查看crond服务状态[root@mail ~]# service crond status crond (pid 2265) is running...
#中止crond服务[root@mail ~]# service crond stop Stopping crond: [ OK ] #启动crond服务 [root@mail ~]# service crond start Starting crond: [ OK ] #重启crond服务 [root@mail ~]# service crond restart Stopping crond: [ OK ] Starting crond: [ OK ] #从新加载crond配置 [root@mail ~]# service crond reload Reloading crond: [ OK ] [root@mail ~]#
#编辑定时任务内容 [root@mail ~]# crontab -e
crontab定时任务详解blog
#!/bin/bash T=1214 #重启时间 while(true) do sleep 59 time=$(date "+%H%M") if [ $time == $T ];then #重启程序命令 reboot else echo doNothing fi done
[root@mail ~]# vim /etc/rc.local
#在最后添加一行 /root/restart.sh &