Centos7 计划定时重启

2020-05-27  本文已影响0人  broeeee

ROOT

  1. 编辑配置
vi /etc/crontab
  1. 设置重启时间
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
10 05 * * * root reboot #每天凌晨5点10分重启系统  //北京时间
10 20 * * * root reboot #每天晚上20点10分重启系统 //美国时间
10 20 * * 2,4,6 root reboot #每周的周二,周四,周六晚上20:10重启
  1. 加载
#root下才能执行
crontab /etc/crontab
  1. 设置开机启动
systemctl enable crond.service #开启启动
systemctl restart crond.service #重启服务
  1. 查看定时配置
crontab -l
last reboot
who -b
上一篇 下一篇

猜你喜欢

热点阅读