zoukankan      html  css  js  c++  java
  • [linux] reboot和shutdownr的区别

    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一致,两者都是平稳地终止服务后重启。

  • 相关阅读:
    “扫一扫”模型
    CenterNet算法介绍
    PyTorch搭载的CenterNet算法环境配置
    软件评测
    代码规范制定
    寒假作业 2/2
    软件工程实践总结&个人技术博客
    React 请求拦截与接口统一和模拟解决方案
    软件评测
    结对作业二
  • 原文地址:https://www.cnblogs.com/hjfeng1988/p/4519081.html
Copyright © 2011-2022 走看看