Linux有如下的關(guān)機和重啟命令:shutdown, reboot, halt, poweroff,那么它們有什么區(qū)別呢?
shutdown - 建議使用的命令
shutdown是最常用也是最安全的關(guān)機和重啟命令,它會在關(guān)機之前調(diào)用fsck檢查磁盤,其中-h和-r是最常用的參數(shù):-h:停止系統(tǒng)服務(wù)并關(guān)機
-r: 停止系統(tǒng)服務(wù)后重啟
下面看幾個例子:shutdown -h now --立即關(guān)機
shutdown -h 10:53 --到10:53關(guān)機,如果該時間小于當前時間,則到隔天
shutdown -h +10 --10分鐘后自動關(guān)機
shutdown -r now --立即重啟
shutdown -r +30 'The System Will Reboot in 30 Mins' --30分鐘后重啟并并發(fā)送通知給其它在線用戶
reboot
reboot表示立即重啟,效果等同于shutdown -r now
poweroff
poweroff表示立即關(guān)機,效果等同于shutdown -h now,在多用戶模式下(Run Level 3)不建議使用。
halt
不理會目前系統(tǒng)狀況下,進行硬件關(guān)機,一般不建議使用