安全关机。
语法:
shutdown [OPTION]... TIME [MESSAGE]
shutdown -c [MESSAGE]
TIME,分钟数(整数)
选项:
-r,重启
-h,关闭系统、关闭电源
-c,撤销关机操作
-k,发送关机信息(不关机)
例子:
89分钟后关机;立刻关机
[root@hp430G2 ~]# shutdown -h 89 "Here is a jok." Broadcast message from root@hp430G2 (/dev/pts/0) at 9:35 ... The system is going down for halt in 89 minutes! Here is a jok. [root@hp430G2 ~]# shutdown -h now
先关闭,再取消关机
[root@hp430G2 ~]# shutdown -h 33 "web1 will shutdown in 33 mins." & [1] 2097 [root@hp430G2 ~]# Broadcast message from root@hp430G2 (/dev/pts/0) at 9:39 ... The system is going down for halt in 33 minutes! web1 will shutdown in 33 mins. [root@hp430G2 ~]# shutdown -c shutdown: Shutdown cancelled [1]+ Done shutdown -h 33 "web1 will shutdown in 33 mins." [root@hp430G2 ~]# shutdown -h 33 "web1 will shutdown in 33 mins." & [root@hp430G2 ~]# shutdown -c "shutdown is cancel" shutdown: Shutdown cancelled [1]+ Done shutdown -h 33 "web1 will shutdown in 33 mins." [root@hp430G2 ~]# Broadcast message from root@hp430G2 (/dev/pts/0) at 9:43 ... shutdown is cancel
发送关机消息
[root@hp430G2 ~]# shutdown -k 33 "mail1 will halt." [root@hp430G2 ~]# Broadcast message from root@hp430G2 (/dev/pts/0) at 9:45 ... The system is going down for maintenance in 33 minutes! mail1 will halt.
另外一个用户终端
Broadcast message from root@hp430G2 (/dev/pts/0) at 9:39 ... The system is going down for halt in 33 minutes! web1 will shutdown in 33 mins. Broadcast message from root@hp430G2 (/dev/pts/0) at 9:39 ... The system is going down for halt in 33 minutes! web1 will shutdown in 33 mins. Broadcast message from root@hp430G2 (/dev/pts/0) at 9:42 ... The system is going down for halt in 33 minutes! web1 will shutdown in 33 mins. Broadcast message from root@hp430G2 (/dev/pts/0) at 9:43 ... shutdown is cancel Broadcast message from root@hp430G2 (/dev/pts/0) at 9:45 ... The system is going down for maintenance in 33 minutes! mail1 will halt.