shutdown, halt, poweroff, reboot关机和重启相关命令

关机:halt,poweroff

重启:reboot

关机或者重启:shutdown

reboot命令

-f: 强制,不调用shutdown直接关机

-p: 切断电源

shutdown命令

-t  seconds : 设定在几秒钟之后进行关机程序。
-k : 并不会真的关机,只是将警告讯息传送给所有使用者。
-r : 关机后重新开机,类似reboot。
-h : 关机后停机,类似halt。
-n : 不采用正常程序来关机,用强迫的方式杀掉所有执行中的程序后自行关机。
-c : 取消目前已经进行中的关机动作。
-f : 关机时,不做 fcsk 动作(检查 Linux 档系统)。
-F : 关机时,强迫进行 fsck 动作。
time : 设定关机的时间。
message : 传送给所有使用者的警告讯息。


如果在命令中time无指定,默认为为+1,now为立刻相当于+0,+n相对时间表示法,单位为分钟,hh:mm:绝对时间表示,知名具体时间。

注意加messsage消息的时候,时间不能设置为now或空。

[root@XX ~]# shutdown +5 “System will shutdown after 5 minutes”
Shutdown scheduled for Sun 2019-11-10 03:20:31 GMT, use 'shutdown -c' to cancel.

Broadcast message from root@XX (Sun 2019-11-10 03:15:31 GMT):

“System will shutdown after 5 minutes”
The system is going down for power-off at Sun 2019-11-10 03:20:31 GMT!

[root@XX ~]# shutdown -c

Broadcast message from root@XX (Sun 2019-11-10 03:15:35 GMT):

The system shutdown has been cancelled at Sun 2019-11-10 03:16:35 GMT!

猜你喜欢

转载自www.cnblogs.com/liuxuinUK/p/11829294.html