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