I have heard that "shutdown -h now" is not a graceful shut down command because it does something akin to "kill -9" for all processes, as opposed to "kill -15".
Is this true, and if so, what is a more graceful way of shutting down to ensure everything has time to clean up after its self?
P.s. Using CentOS, Ubuntu, and Debian mainly.
Best Answer
shutdown -h now
will call/etc/rc.d/rc
or/etc/init.d/rc
. Therc
script will call the kill scripts for the new runlevel (0 for-h
, 6 for-r
), followed by any start scripts.You'll see
S30killprocs
orS00killall
or something like that depending on your distro. This comes after all the kill scripts have been called to attempt to stop each service gracefully in turn. It will trykill -15
first, followed bykill -9
.Short answer:
shutdown -h now
orshutdown -r now
are graceful.halt
andreboot
used to be non-graceful, but they will just callshutdown
for you unless you use the-f
option.