Linux命令之shutdown

shutdown [选项] [时间] [通知消息](可以为空,但必须有参数和时间)

系统关机命令,所有登录用户都可看到关机信息。

(1).常用选项

-c 取消已经在进行的shutdown指令内容

-h 关机

-k 发送警告信息给所有登录者

-r 重启

(2).unbuntu独有参数,CentOS没有参数

-f 重启后强制略过fsck磁盘检测

-F 重启后强制进行fsck磁盘检测

(3).实例

特定时间执行关机命令

shutdown –h now             //立即关机
shutdown –h 12:00           //在12:00关机

指定五分钟后关机,并发出警告信息

[root@CentOS6 桌面]#shutdown +5 “This System will be shutdown in 5 minutes”
Broadcast message from root@CentOS6.8
                   (/dev/pts/0) at 13:33 …

The system is going down for maintenance in 5 minutes!                 //系统提醒
This System will be shutdown in 5 minutes                                            //用户自定义提醒

指定3分钟后重启,并发出警告信息

[root@CentOS6 桌面]#shutdown –r +3 “3分钟后关机重启”
Broadcast message from root@CentOS6.8
                   (/dev/pts/0) at 13:53 …

The system is going down for reboot in 3 minutes!          //系统提醒
3分钟后关机重启                                              //用户自定义提醒

给所有登录用户发送提醒

[root@CentOS6 桌面]#shutdown –k “Waring:maybe the system will be shutdown”
Shutdown:time expected
Try’shutdown --help’ for more information.
[root@CentOS6 桌面]# shutdown –k 5 “Waring:maybe the system will be shutdown”
[root@CentOS6 桌面]#
Broadcast message from root@CentOS6.8
                   (/dev/pts/0) at 14:26 …

The system is going down for maintenance in 5 minutes!
Waring:maybe the system will be shutdown

  

posted @ 2018-03-15 15:17  苦逼运维  阅读(27823)  评论(0编辑  收藏  举报