[NTLUG:Discuss] init differences
Chris Cox
cjcox at acm.org
Fri Aug 14 08:58:13 CDT 2009
Leroy Tennison wrote:
> Learned recently that other *NIX use cumulative run levels where it
> appears that Linux puts links to every script needed for a given run
> level in it's rc?.d directory. Is there a reason for this or is it just
> stylistic preference?
>
> Also, seems that SuSE has more run levels than Red Hat (particularly S
> unless Red Hat has added that since I last used it), is there a good
> reason why?
In the Unix/Linux world (for those that use a System V style init), the
runlevels should be viewed as simply definitions of a "state". That is,
there is no correlation between runlevels. Each one stands on its own
and can be defined however you want.
That means that there are really no standards for runlevels. However,
there is general practice that runlevel 1 means single user, 6 means
shutdown and reboot and 0 means halt (and/or sometimes poweroff).
On Linux distros using a SysV style init, runlevel 2 is multiuser.
Often times, runlevel 3 is runlevel 3 with network services that are rpc
based (e.g. NFS, NIS, etc) and runlevel 5 is similar to 3 but with an
Xserver (usually a login display manager) started.
What I just said is NOT a hard and fast rule across all Linux though...
so you WILL find systems that might use runlevel 4, you might find some
that include X Server all of the time when going to any multiuser
capable runlevel.
The idea of putting the init scripts into a common directory and
symlinking them into the runlevel directories is also not always the
case, but a very common practice. On Linux distros usually /etc/init.d
holds the scripts and as you said, they are symlinked starting with SXX
or KXX into the runlevel areas, The SXX symlinked ones will make the
runlevel master script invoke the individual scripts with the argument
"start" and the KXX ones with the argument "stop". The initial kickoff
of what happens when entering a runlevel is handled via /etc/inittab.
That's where you see the runlevel script manager getting kicked off.
If you're a Solaris user before Solaris 10, you'll noticed that Sun
didn't understand what SysV runlevels were (Sun used to use a BSD based
OS), and so Sun made their runlevel 3 dependent upon runlevel 2. That
is just wrong and somewhat embarrassing. Solaris 10 removed that piece
of stupidity by replacing scripted init with something more closed (and
more hideous).
More information about the Discuss
mailing list