“ 目录:RHCA+ -> 11 系统管理 -> 11 shutdown命令(关机) ”
关机、重启等操作;语法格式:shutdown [参数] 时间
涉及硬件资源的管理权限,以root身份运行
指定时间关机时,系统会在关机前5分钟创建/run/nologin文件,阻止新用户登录
参数 | 作用 |
-h | 关机并断电 hours:minutes & #到指定时间关机 +10 #十分钟后 now #现在 |
-r | 重启 |
-c | 取消定时关机操作 |
-H | 停止系统 |
-P | 切断电源,安全断电 |
-k | 只发送警告消息,不实际关机 |
[root@wuzuniao ~]# shutdown -h now #立即关机
[root@wuzuniao ~]# shutdown -r now #立即重启
[root@wuzuniao ~]# shutdown -h 23:50 #设置将在23点50分关机;可加&放入后台进程
Shutdown scheduled for Tue 2024-07-16 23:50:00 CST, use 'shutdown -c' to cancel.
Broadcast message from root@wuzuniao (Tue 2024-07-16 23:43:50 CST):
The system is going down for power-off at Tue 2024-07-16 23:50:00 CST!
[root@wuzuniao ~]# shutdown -c #取消定时设置
Broadcast message from root@wuzuniao (Tue 2024-07-16 23:45:08 CST):
The system shutdown has been cancelled at Tue 2024-07-16 23:46:08 CST!
[root@wuzuniao ~]#