linux设置服务器定时重启吗,Centos7配置定时重启服务器
Crontab是一個很方便的在unix/linux系統(tǒng)上定時(循環(huán))執(zhí)行某個任務(wù)的程序。
用 service crond status 查看 crond服務(wù)狀態(tài),如果沒有啟動則 systemctl start crond.service啟動它。
直接編輯crontab文件,vi /etc/crontab,會看到一個crontab的例子:
# 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
不指定具體的時間用*號替代,用空格區(qū)分時間參數(shù),最后是到時要執(zhí)行的操作。
如:在每天的下午17:01執(zhí)行一次reboot重啟服務(wù)器操作 :
1 17 * * * root reboot
然后重啟服務(wù)
systemctl restart crond.service
總結(jié)
以上是生活随笔為你收集整理的linux设置服务器定时重启吗,Centos7配置定时重启服务器的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 他们说 我是个冷淡的人。
- 下一篇: 哈希之闭散列