Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What I understand from runlevels is that in each level some programs have permission to be executed and some don't. runlevel 3 boots system into CLI and runlevel 5 starts the default GUI.

But I don't understand what do 0(shutdown) and 6(reboot) mean?(Start in shutdown/reboot mode?!). What happens If set initdefault to these values?

share|improve this question

2 Answers 2

up vote 11 down vote accepted

If you start in these, the system will shut down/reboot as soon as it enters the runlevel. A runlevel is essentially just a way of specifying actions you want to take when you enter/leave a certain state, in that respect, once those runlevels are entered they execute programs that prepare the computer to shut down or reboot, respectively.

share|improve this answer

You can check this out first hand in

/etc/rc0.d
/etc/rc6.d

If a script name starts with an "S", it runs at startup; if it starts with a "K", it runs at shutdown (or, when moving down a level). Check out this answer and especially the comments (corrections) made by James O'Gorman.

Edit - be sure to check out Dave Sherohman's comment below.

share|improve this answer
5  
I think it would be clearer to say that "S" scripts run when the system enters that runlevel and "K" scripts run when it leaves that runlevel (by entering a different one). "Startup" and "shutdown" sound like you're talking about system startup/shutdown, which is not the case here. –  Dave Sherohman Nov 15 '12 at 11:01
    
Hej! Yes, I agree. Made an edit. –  Emanuel Berg Nov 15 '12 at 16:42
3  
I still think it is unclear. Moving from runlevel 1 to 2 (in Debian, that's traditionally the transition from single-user to multi-user-without-X) runs the runlevel 1 K scripts (followed by the runlevel 2 S scripts), but certainly doesn't move "down a level". Same for runlevel 3 or 5 to 6, or 3 to 0, or any of a myriad other combinations. It is much better to simply reason about what scripts are run when entering (S, if any exist) or exiting (K, again if any exist) a specific runlevel. –  Michael Kjörling Nov 15 '12 at 19:37
    
@MichaelKjörling: Yes: "S" for enter (you could think of "start" although it could originally be something else - well, doesn't matter as long as you remember it), and "K" for exit ("kill"). This seems to be straightforward enough, so I'll make an effort to be less "relaxed" when I describe things in the future. –  Emanuel Berg Nov 15 '12 at 19:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.