欢迎光临
我们一直在努力

CentOS7 设置定时重启

1.编辑配置

vi /etc/crontab
2.设置重启时间

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

# For details see man 4 crontabs

# 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
20 04 * * * root reboot #04:20 每天凌晨4点20分重启系统
*/10 * * * * root reboot #10分钟重启一次
* */4 * * * root reboot #隔4个小时重启一次
3.装载

crontab /etc/crontab
4.重启定时服务

systemctl enable crond.service #开启启动
systemctl restart crond.service #重启服务

5.查看定时配置

crontab -l

查看系统重启情况(常用方法):

last reboot
who -b

http://xzh.i3geek.com
赞(0) 打赏
未经允许不得转载:老徐小屋老徐小屋 » CentOS7 设置定时重启
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址