[Gllug] local loopback interface

brichardson at lineone.net brichardson at lineone.net
Wed Jul 25 11:14:58 UTC 2001


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 7/25/01, 7:55:09 AM, "Paul Brazier" <pbrazier at cosmos-uk.co.uk> wrote
regarding Re: [Gllug] local loopback interface:

> I'm not sure if there's a single config file that corresponds to these
> services or if the GUI is pulling together information from disparate
> scripts and files and presenting them as a unified list of services.
> Perhaps it looks for all server daemons in /etc/rc.d/init.d/?
> Does Linux look through this directory on boot to see if there are any
> daemons to start automatically?

Not directly.  It will look for scripts in /etc/rcS.d (on Debian and
Mandrake, other distributions may vary this location) and run them.
These will actually be symlinks to scripts in /etc/init.d.

This is how it works:

Each installed service places a script in /etc/init.d.  You can use
these scripts directly to start, stop or restart a service by typing

        /etc/init.d/scriptname start

or stop or restart.

When your system gets through loading the kernel, it checks
/etc/inittab for the start-up script (/etc/init.d/rcS on my system).
This then runs each script in /etc/rcS.d/ - so services which need to
start on boot have symlinks to their /etc/init.d scripts in /etc/rcS.d

This is just a special case of the way Linux changes run levels.
Linux uses 8 runlevels - 0 to 6 and S.  Each of these has a directory 
(/etc/rc0.d, /etc/rc1.d, /etc/rc2.d and so on) containing symlinks to 
scripts in /etc/init.d.  If you look, you'll see that the symlinks are 
named S01script or K45script or whatever.  When your system changes to 
a new runlevel it kills all the services whose symlinks begin with K 
(that is, it runs the scripts with a "stop" paramerter) and starts all 
the services whose symlinks begin with S (runs the scripts with a 
"start" parameter).  The numbers after the S or K determine the order 
in which the scripts are run.

S is the startup level, so all the links in /etc/rcS.d begin with S 
(nothing to kill).  0 is the runlevel used to shut down your machine 
and 6 is the runlevel used to restart it.  1 is used for single-user 
maintenance mode.  The other runlevels - that's up to the 
distribution.

When your machine starts, it goes first to runlevel S then to the 
default runlevel (2 on Debian, 3 on Red Hat IIRC) - the default is set 
in /etc/inittab.

This may all seem a bit complex but it means that the script needed to 
start or stop a service need only be put in one place.  Then you can 
create a whole set of different working environments (with or without 
an X login, with or without networking, running this database or that 
mail system etc) by creating the appropriate links in /etc/rcX.d.

Your system didn't have a link to /etc/init.d/networking in /etc/rcX.d 
(where X is your default runlevel).  When you ticked a box in your GUI 
config tool, it created the appropriate symlink.

If you want to see how the bones of your system are laid out, start 
with the init man-page then read /etc/inittab and the scripts in 
/etc/init.d

-- 

Bruce




-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list