栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Centos7配置定时重启服务器

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Centos7配置定时重启服务器

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

关闭开机启动

systemctl disable crond.service
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/612644.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号