00. 目录
01. 命令概述
shutdown命令用来系统关机命令。shutdown指令可以关闭所有程序,并依用户的需要,进行重新开机或关机的动作。
02. 命令格式
格式:shutdown [选项] [参数]
- 1
03. 常用选项
-c 当执行“shutdown -h 11:50”指令时,只要按+键就可以中断关机的指令
-f 重新启动时不执行fsck
-F 重新启动时执行fsck
-h 将系统关机
-k 只是送出信息给所有用户,但不会实际关机
-n 不调用init程序进行关机,而由shutdown自己进行
-r shutdown之后重新启动
-t 送出警告信息和删除信息之间要延迟多少秒
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
04. 参考示例
4.1 立即关机
[root@localhost ~]# shutdown -h now
[root@localhost ~]#
- 1
- 2
4.2 指定10分钟后关机,同时发送警告信息给登录用户
[root@localhost ~]# shutdown +10 "System will shutdown after 10 minutes"
[root@localhost ~]#
- 1
- 2
4.3 取消按照预定时间关机
[root@localhost ~]# shutdown -c
[root@localhost ~]#
- 1
- 2
4.4 重启系统
[root@localhost ~]# shutdown -r now
[root@localhost ~]#
- 1
- 2
4.5 指定时间关机
[root@localhost ~]# shutdown -h 22:00
Shutdown scheduled for 四 2019-08-29 22:00:00 CST, use 'shutdown -c' to cancel.
[root@localhost ~]#
- 1
- 2
- 3
设置多久时间后执行shutdown命令。时间参数有hh:mm或+m两种模式。hh:mm格式表示在几点几分执行shutdown命令。例如 “shutdown 10:45”表示将在10:45执行shutdown.+m表示m分钟后执行shutdown.比较特别的用法是以now表示立即执行shutdown. 值得注意的是这部分参数不能省略。另外,需要注意如果现在已经22:30,你执行了shutdown -h 22:00 & 那么第二天才会关机。
4.6 30分钟重启,并提示信息
[root@localhost ~]# shutdown -r +30 "reboot now"
Shutdown scheduled for 四 2019-08-29 20:38:16 CST, use 'shutdown -c' to cancel.
[root@localhost ~]#
- 1
- 2
- 3
4.7 只是送出信息给所有用户,但不会实际关机
[root@localhost ~]# shutdown -k now "The System will reboot"
[root@localhost ~]#
- 1
- 2
4.8 重启时不进行磁盘检测,加快开机速度
[root@localhost ~]# shutdown -rf now
[root@localhost ~]#
- 1
- 2
评论记录:
回复评论: