Thursday, October 9, 2008

Shutdown, Reboot and Init Process Flow On Solaris Unix

Hey There,

Today's post harkens back to an earlier post we did on clearing up some common misconceptions about Solaris run levels. That post took care of going through the in's and out's of what the differences between boot, reboot, init, shutdown, etc, all mean and has a lot of good practical examples to demonstrate each point.

Branching off from that post, today we're going to add something of an appendix to it. If you're interested in some of the nittier gritty of the Solaris run level changing process, definitely give that older post another look. Maybe it'll go down easier the second time ;)

Below, we've got a nice collection of commands that would (or could) normally be executed by a root (or privileged) user to switch run levels, put together with what run level scripts in what run level script directories get run when those commands get ...executed (almost typed "run" again ;) And, just for flavor, the command and the script/directory execution sequence are further segmented into what run level the Solaris Unix OS switches to at each salient point. Note that, when you see a run level listed in the "run level" column, it's at this point that the run level has become the run level listed. Any points without run levels listed are executed at the run level of the previous entry in the example. Just trying to write a thousand words on how to not have to explain subtle differences in understanding of the blatantly obvious. I'm well on my way to being even more confused than I was when I woke up this morning... ;)

Hope you enjoy this chart and find it useful. Print it out and stick it to your refrigerator with lots of magnets from various pizza parlours and real estate agents. You never know when you'll have an epiphany in the kitchen. ...it's getting late in the day (both technically and figuratively) when you're all alone telling in-jokes ;)

Note: This chart assumes that you're starting from run level 0 (except for the reboot, init 6 and "shutdown -i6" sections). Generally, you can reverse the order of execution if you're starting from, say, run level 3, or combine multiple actions (or their opposites) when transitioning from one particular run level to the next. The stop/start lines for identical run level directories are also dependent on your understanding of which direction you're heading (down to 0 or up to 3, for instance). If this is too confuggling, just let me know :) Again, our previous post on unconfusing Solaris run levels may be of help in conjunction with this little map. Switching to run level 5 has been left out on purpose. Since that level is "power down," everything's going the way of the K ;)

Cheers and pardon the formatting,



command run level directories/scripts current run level (retrieved from "who -r" if it seems to not make sense)

boot -s /etc/rcS.d/S* start 0

boot -S /etc/rcS.d/S* start 0

reboot -- -s /etc/rcS.d/S* start 3

shutdown -is /etc/rcS.d/K* stop S

shutdown -i0 /etc/rc0.d/K* stop 0
/etc/rc0.d/S* start

shutdown -i6 /etc/rc0.d/K* stop 6
/etc/rc0.d/S* start
/etc/rcS.d/S* start
/etc/rc2.d/S* start 3
/etc/rc3.d/K* stop
/etc/rc3.d/S* start

init 0 /etc/rc0.d/K* stop 0
/etc/rc0.d/S* start

init s /etc/rcS.d/K* stop S
/etc/rcS.d/S* start

init S /etc/rcS.d/K* stop S
/etc/rcS.d/S* start

init 1 /etc/rc1.d/K* stop 1
/etc/rc1.d/S* start

init 2 /etc/rc2.d/K* stop 2
/etc/rc2.d/S* start

init 3 /etc/rc3.d/K* stop 3
/etc/rc3.d/S* start

init 6 /etc/rc0.d/K* stop 6
/etc/rc0.d/S* start
/etc/rcS.d/S* start
/etc/rc2.d/S* start 3
/etc/rc3.d/K* stop
/etc/rc3.d/S* start




, Mike




Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.