Red Hat / RHEL / CentOS 上的 init 6 和 reboot 有什么区别?

ujj*_*ain 7 redhat centos electrical-power rhel6 shutdown

在 Linux 中,init 6 命令先优雅地重新启动运行所有 K* 关闭脚本的系统,然后再重新启动。reboot 命令可以非常快速地重新启动。它不执行任何终止脚本,而只是卸载文件系统并重新启动系统。重启命令更有力。

来源:http : //www.vreference.com/2009/09/23/reboot-is-not-the-same-as-init-6/

对于 Unix 系统作为 Solaris,这似乎是正确的,但我一直将以下 3 个命令视为同义词,因为它们似乎都在卸载文件系统并重新启动服务器之前关闭服务:

shutdown -r now
reboot
init 6
Run Code Online (Sandbox Code Playgroud)

有人能说出这些命令之间的区别吗?

小智 12

它们没有区别。在内部,它们做完全相同的事情:

 1. reboot uses the shutdown command (with the -r switch). The shutdown command used to 
    kill all the running processes, unmount all the file systems and finally tells the
    kernel to issue the ACPI power command.

 2.init 6 tells the init process to shutdown all of the spawned processes/daemons as
   written in the init files (in the inverse order they started) and lastly invoke the 
   shutdown -r now command to reboot the machine
Run Code Online (Sandbox Code Playgroud)