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关机

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

[[email protected] 桌面]#shutdown +5 “This System will be shutdown in 5 minutes” 
Broadcast message from [email protected] 
                   (/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分钟后重启,并发出警告信息

[[email protected] 桌面]#shutdown –r +3 “3分钟后关机重启” 
Broadcast message from [email protected] 
                   (/dev/pts/0) at 13:53 … 
 
The system is going down for reboot in 3 minutes!          //系统提醒 
3分钟后关机重启                                              //用户自定义提醒

给所有登录用户发送提醒

[[email protected] 桌面]#shutdown –k “Waring:maybe the system will be shutdown” 
Shutdown:time expected 
Try’shutdown --help’ for more information. 
[[email protected] 桌面]# shutdown –k 5 “Waring:maybe the system will be shutdown” 
[[email protected] 桌面]# 
Broadcast message from [email protected] 
                   (/dev/pts/0) at 14:26 … 
 
The system is going down for maintenance in 5 minutes! 
Waring:maybe the system will be shutdown 

  

原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/2837.html

(0)
上一篇 2021年7月16日
下一篇 2021年7月16日

相关推荐

发表回复

登录后才能评论