目錄
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 &