在 Linux 中,init 6 命令会先运行所有 K* 关闭脚本,然后正常重启系统,然后再重启。reboot 命令会快速重启系统。它不会执行任何 kill 脚本,而只是卸载文件系统并重启系统。reboot 命令更加强制。
来源:http://www.vreference.com/2009/09/23/reboot-is-not-the-same-as-init-6/
对于 Solaris 等 Unix 系统来说,这似乎是正确的,但我一直将以下 3 个命令视为同义词,因为它们似乎都在卸载文件系统并重新启动服务器之前关闭服务:
shutdown -r now
reboot
init 6
有人能说出这些命令之间的区别吗?
答案1
它们之间没有区别。从内部来看,它们做的事情完全一样:
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