linux - What is the difference between reboot , init 6 and shutdown -r now?
System/Linux 2015. 6. 27. 23:05What is the difference between reboot , init 6 and shutdown -r now?
Q.
I just want to know difference between in
rebootinit 6shutdown -r now
and which is the safest and the best?
A.
There is no difference in them. Internally they do exactly the same thing:
rebootuses theshutdowncommand (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. The source can be found here. In older distros the reboot command was forcing the processes to exit by issuing theSIGKILLsignal (still found in sources, can be invoked with-foption), in most recent distros it defaults to the more graceful and init friendlyinit 1 -> shutdown -r. This ensures that daemons clean up themselves before shutdown.init 6tells theinitprocess to shutdown all of the spawned processes/daemons as written in the init files (in the inverse order they started) and lastly invoke theshutdown -r nowcommand to reboot the machine
Today there is not much difference as both commands do exactly the same, and they respect the init scripts used to start services/daemons by invoking the shutdown scripts for them. Except for reboot -f -r now as stated below
There is a small explanation taken from manpages of why the reboot -f is not safe:
-f, --force
Force immediate halt, power-off, reboot. Don't contact the init system.
Edit:
Forgot to mention, in upcoming RHEL distributions you should use the new systemctl command to issue poweroff/reboot. As stated in the manpages of reboot and shutdown they are a legacy command available for compatibility only. and the systemctl method will be the only one safe.
source - http://unix.stackexchange.com/questions/64280/what-is-the-difference-between-reboot-init-6-and-shutdown-r-now
'System > Linux' 카테고리의 다른 글
| linux - kmod vs akmod (0) | 2015.07.05 |
|---|---|
| linux - history clear (0) | 2015.07.03 |
| linux - What is the purpose of having three(or more?) directories with icons? (0) | 2015.06.24 |
| linux - gnome desktop file (0) | 2015.06.23 |
| linux - fedora packaging guidelines (0) | 2015.06.23 |




