reboot 用於重新啟動 Linux 系統,相當於 shutdown -r now。
reboot [選項]
| 選項 | 說明 |
|---|---|
-w | 僅寫入 /var/log/wtmp 紀錄,不真正重開機 |
-d | 重開機但不寫入 /var/log/wtmp |
-i | 重開機前關閉網路介面 |
-f | 強制重開機,不呼叫 shutdown(緊急情況使用) |
[root@rhel ~]# reboot
Broadcast message from root@rhel
(/dev/pts/1) at 1:21 ...
The system is going down for reboot NOW!
reboot -w
reboot -f
| 指令 | 行為 | 適用場景 |
|---|---|---|
reboot | 立即重開機 | 一般維護 |
shutdown -r now | 立即重開機,發送警告訊息給所有登入用戶 | 多用戶環境 |
shutdown -r +10 | 10 分鐘後重開機 | 排程維護 |
systemctl reboot | 透過 systemd 重開機 | systemd 系統 |
init 6 | SysVinit 相容指令 | 舊版系統 |
日常管理用 reboot 或 systemctl reboot 即可;需通知用戶用 shutdown -r;系統無回應時才用 reboot -f 強制重開。