在使用Linux时为了服务器的稳定性一般会设置Linux定时重启关机
这里需要使用到的命令 shutdown
命令参数 -r 重启 -h 关机 -t秒数 +分钟数
例如
shutdown -r -t 0 则立即重启 shutdown -h -t 0 则立即关机 shutdown -r -t 30 30秒后重启 shutdown -r +10 10分钟后重启 shutdown -h +10 10分钟后关机 shutdown -r "01:00" 定时凌晨1点自动重启
撤销指令
shutdown -c
我们可以将命令加入到开机启动脚本 /etc/rc.local
添加 shutdown -r "01:00" 来实现每次开机后 自动设定下次重启时间为凌晨1点
转载请注明:雪宝小站-雪宝的小知识库 » LINUX相关 » Linux定时重启关机