[NTLUG:Discuss] Hosed up my system

Chris Cox cjcox at acm.org
Tue Mar 19 22:04:10 CST 2002


bryn konti wrote:
> 
> Thanks for replying Chris.....the more people explain
> how linux and unix work, the more I understand.  I
> have just two more questions on the subject of
> runlevels:  What are the differences between unix and
> linux runlevels and is there a standard configuration
> method to add/remove  and start/stop the rc scripts in
> various runlevels?

The standard for System V init is to have scripts labeled
SXXname placed into directories typically at /etc/rc#.d.
Where XX is a two digit number and # is a runlevel.
The file /etc/inittab will show you how all of this
gets kicked off.

The scripts in /etc/rc#.d are often times symbolic links
to the real script residing in /etc/init.d.  But the
scripts don't have to be symbolic links, nor do they
have to have representation in /etc/init.d.  I will warn
you that a particular distribution's administration
tools may make some assumptions with regards to this.
Of course, "real penguins" don't use the admin tools :-).

The other style is often referred to as BSD init script
style.  In fact, there are some Linux distributions that
prefere this style over the System V one.  However, I've
always found maintaining the BSD style to be more
difficult and usually very error prone.  You can do a
google search and find some examples (for either style
really).

SuSE takes a fairly unique approach by enabling services
via variable tags that are sourced in from rc.config
into every runlevel script.  Their reasoning is that
the order in which services have to be brought up and
down is not clear, so they link in every script at
the "proper" SXXname or KXXname in the "proper" runlevel
directory... and then the variable tags tell the system
whether the script needs to do anything or not.
This is SuSE's way of solving the daemon order of
execution problem.

Others have already talked about the runlevel numbers, the
ones in common:
0 - halt
1 - single user
2 - networked
6 - reboot

3 is usually broader network services (typically NFS)
5 is often X Window System, but in Solaris, as mentioned,
  it has X even at runlevel 2.

On a well configured system you should be able to move
between the runlevels using 'init #' or 'telinit #'
without the system getting confused (dare you to try
this with Solaris btw especially if you have a lot of
network services configured..NIS, NFS, etc).

Regards,
Chris




More information about the Discuss mailing list