[linux] reboot和shutdown-r的區別


google看看:

先搜英文的資料

http://askubuntu.com/questions/441969/what-is-the-difference-between-reboot-and-shutdown-r

(ubuntu論壇)

結論是:reboot uses shutdown -r

http://unix.stackexchange.com/questions/64280/what-is-the-difference-between-reboot-init-6-and-shutdown-r-now

(好像討論的是linux問題)

結論是:reboot uses the shutdown command (with the -r switch).

再搜索中文的資料

http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=1383005&highlight=reboot%2Bshutdown%2B-r

(freebsd論壇)

結論是:reboot命令重啟動系統時是刪除所有的進程,而不是平穩地終止它們

 

 

先看下freebsd 9.3

root@93a:~ # man reboot
REBOOT(8)               FreeBSD System Manager's Manual              REBOOT(8)
DESCRIPTION
     The halt and reboot utilities flush the file system cache to disk, send
     all running processes a SIGTERM (and subsequently a SIGKILL) and, respec-
     tively, halt or restart the system.  The action is logged, including
     entering a shutdown record into the user accounting database.

root@93b:~ # man shutdown
SHUTDOWN(8)             FreeBSD System Manager's Manual            SHUTDOWN(8)
DESCRIPTION
     The shutdown utility provides an automated shutdown procedure for super-
     users to nicely notify users when the system is shutting down, saving
     them from system administrators, hackers, and gurus, who would otherwise
     not bother with such niceties.

     -r      The system is rebooted at the specified time.

本人英文較爛,按自己的翻譯能力得知:

reboot過程會把系統的緩存寫到硬盤,先發送SIGTERM再發送SIGKILL;

shutdown過程友好地通知線上用戶,然后完好地保存。

結論即是:reboot與shutdown -r過程一致

 

下面是自己實際操作的結果

很明顯reboot沒有出現deamon平穩地終止過程,這是鬧哪樣啊。

 

順便看下centos 6.7

[root@vhost102 ~]# man reboot
DESCRIPTION
       These programs allow a system administrator to reboot, halt or poweroff the system.

       When  called with --force or when in runlevel 0 or 6, this tool invokes the reboot(2) system call itself and directly reboots the system.  Otherwise this simply invokes the shutdown(8)
       tool with the appropriate arguments.

       Before invoking reboot(2), a shutdown time record is first written to /var/log/wtmp

[root@vhost102 ~]# man shutdown
DESCRIPTION
       shutdown arranges for the system to be brought down in a safe way.  All logged-in users are notified that the system is going down and, within the last five minutes of TIME, new logins
       are prevented.
OPTIONS
       -r     Requests that the system be rebooted after it has been brought down.

 

reboot --force 調用reboot重啟系統,否則調用適當的shutdown參數

shutdown會安全地關機

結論即是:reboot與shutdown -r過程一致

reboot的過程

shutdown -r now的過程

 

 

總結一個吧

freebsd 9.3 reoot與shutdwon -r now不一致,reoot沒有平穩地終止服務強制重啟。

centos 6.7 reoot與shutdwon -r now一致,兩者都是平穩地終止服務后重啟。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM