What's the difference between halt and shutdown now?
halt
can turn off the machine,
but shutdown now
doesn't turn off ,it just logs the root
off.
Anyone knows the reason?
On a modern Linux systems halt calls shutdown with a suitable argument -h (halt) or -r (reboot) these are the equivalent of runlevels 0 and 6. Running shutdown now
puts the system into runlevel 1 (single user mode). If you want to halt the system with shutdown use shutdown -h now
.
On Solaris 10/11 halt is quite brutal, it just flushes the disk caches and powers off the system - no attempt is made to run any scripts or shutdown smf facilities.
Other systems may do things differently too.
I assume Linux? (Good practice to tell or at least tag the OS).
'shutdown now' puts the system in init 1, while 'shutdown -h now' halts it 'now'.
From the manual of shutdown
shutdown does its job by signalling the init process, asking it to change the runlevel. Runlevel 0 is used to halt the system, runlevel 6 is used to reboot the system, and runlevel 1 is used to put to system into a state where administrative tasks can be performed; this is the default if neither the -h or -r flag is given to shutdown. To see which actions are taken on halt or reboot see the appropriate entries for these runlevels in the file /etc/inittab.