原由在於:重啓服務器後有時候服務不會啓動,而有時候又能夠自動運行,惟一差異在於重啓命令用的是reboot仍是init 6.
後查了相關資料,居然大有玄機:
對這兩個操做使用man命令看到的內容以下:
init 6 Stop the operating system and reboot to the state defined by the initdefault entry in /etc/inittab.
reboot - reboot performs a sync(1M) operation on the disks, and then a
multi- user reboot is initiated. See init(1M) for details.
"init 6" 基於一系列/etc/inittab文件,而且每一個應用都會有一個相應shutdown腳本。
'init 6' 調用一系列shutdown腳本(/etc/rc0.d/K*)來使系統優雅關機;
'reboot'並不執行這些過程,reboot更是一個 kernel級別的命令,不對應用使用shutdown腳本。 .
咱們應該在一般狀況下使用 init 6.
在出問題的情況下或強制重啓 時使用reboot.
reboot is a more aggresive command to use. init 6 is much graceful
服務器
use of `init 6` will give the cleanest and orderly reboot (init informs svc.startd of the runlevel change and will move to the appropriate milestone).app
use of `shutdown -y -g0 -i6 **message**` will invoke init as well as give you grace period and messages to user (shutdown invoked the same as init above).ide
halt,reboot,poweroff will not run any of the shutdown scripts and should be last resort.orm