首页 > 其他 > 详细

Centos7配置定时重启服务器

时间:2019-07-05 23:24:03      阅读:158      评论:0      收藏:0      [点我收藏+]

Crontab是一个很方便的在unix/linux系统上定时(循环)执行某个任务的程序。
用 service crond status 查看 crond服务状态,如果没有启动则 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

不指定具体的时间用*号替代,用空格区分时间参数,最后是到时要执行的操作。
如:在每天的下午17:01执行一次reboot重启服务器操作 :

1 17 * * * root reboot

然后重启服务

systemctl restart crond.service


作者:余木脑袋
链接:https://www.jianshu.com/p/79a8fa565ff2
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

Centos7配置定时重启服务器

原文:https://www.cnblogs.com/valu/p/11141214.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!