The "shutdown" command takes options. For example, Linux lets you specify halting or rebooting or just going to single user mode. However, shutdown really uses init to accomplish this.
The "shutdown" command takes options. For example, Linux lets you specify halting or rebooting or just going to single user mode. However, shutdown (on older systems) really uses init to accomplish this. So when you tell shutdown to reboot, you are really telling it to do whatever inittab tells it to do for run state 6.
Systems that have moved beyond inittab probably work in a similar way. See, for example Upstart shutdown process.
Other OSes make that more obvious: SCO's shutdown has a -i flag to specify the desired init state.
The reason I bring that up is that I've had a situation where, for their own esoteric reasons, a client wanted to disable the option so that it would NOT reboot. On SCO, the only thing that causes the reboot is the "uadmin 2 1" in inittab. On Linux, it's the "/etc/rc.d/rc 6" that ends up running /etc/rc.d/rc6.d/S01reboot
On SCO, it's interesting to note that the /etc/reboot command doesn't call "uadmin 2 1"; it calls "uadmin 2 2", which is what init 5 calls. So on SCO, "reboot" is not quite the same as a shutdown -i6. On Linux (older Linux), S01reboot ends up calling "reboot".
Just like anything else, shutdown can hang and fail to finish. See (for example) shutdown script hangs.
Got something to add? Send me email.
More Articles by Tony Lawrence © 2013-08-19 Tony Lawrence