Differences between shutdown -r and reboot

Extracted from debian-user
Tip provided by Miquel van Smoorenburg
>>Besides, it is good practice to use "shutdown -r now" instead
>>of reboot. Or just press ctrlaltdel, because then init just calls
>>the command "shutdown -r now" for you.
>Could you please explain why?

"reboot" under SystemV traditionally does just that, it reboots the
system. Hard.

Due to historical BSD tradition and the first init for Linux being BSD-like
(remember simpleinit?) people expect "reboot" to do an orderly shutdown
and reboot.

So, the "reboot" command has to guess the context in which it is being
used, and then decide to do a hard reboot by calling the reboot(2)
system call, or to do an orderly shutdown. In the last case, it just
calls "shutdown -r now" for you!

It guesses that context by checking the runlevel (which is stored in
/var/run/utmp on a correctly running system). If it's "0" or "6",
reboot will assume it has to do a hard reboot. If it's "1" ... "5",
shutdown will be called. If it's anything else or reboot gets confused,
it prints a warning messages and calls shutdown.

Follow-up : (1)  
| Previous | Next | Index of category | Main Index | Submit |

Appears in section(s) : FMTYWTK
Tip recorded : 17-12-1998 18:21:05
HTML page last changed : 27-07-1999 20:08:12