Hi Petter

On Thu, Jan 1, 2009 at 11:23, Petter Reinholdtsen <p...@hungry.com> wrote:

> Btw, why run a script both at the end of rcS.d and at the start of
> rc[0-6].d?  It seem redundant to me.  Why not only run one at the end
> of rcS.d (which is imedately before the start of rc[0-6].d), and then
> again at the end of rc[0-6].d?

The zleds script has a K and and S symlink for each runlevel, because
zleds relies on the fact that K scripts are run with a 'stop'
argument, and S scripts are run with a 'start' argument. Passing the
'stop' argument to zleds causes it to run the leds script
(/usr/bin/leds) with a 'boot' argument before the argument that
indicates the runlevel, e.g rc2 -> rc0: '/etc/rc0.d/K05zleds stop' ->
'leds boot shutdown'. In this example, 'leds boot shutdown' causes the
Ready/Status LED to alternate between green and amber. Passing the
'start' argument to zleds causes it to run the leds script without a
'boot' argument before the argument that indicates the runlevel, e.g
rc2 -> rc1: '/etc/rc1.d/S99zleds start' -> 'leds singleuser'. In this
example, 'leds singleuser' causes the Ready/Status LED to turn amber.
Essentially, passing 'stop' to zleds indicates to the script that we
have started running the scripts in the new runlevel, and passing
start to zleds indicates that we have finished running the scripts in
the new runlevel.

Below, I've listed some example transitions from one runlevel to the
next runlevel (these are actually what /etc/init.d/rc does without
insserv installed) and the commands that are run in the zleds script.
Based on this output, and my analysis of /etc/init.d/rc, it seems to
me that insserv and doesn't do the correct thing when a service is
stopped and started in the same runlevel.

rcS -> rc[2-5]
--------------

rcS:
        S99zleds start:
        leds system
        (Ready/Status: amber)

rc2:
        (no K scripts run because previous level was S)

        S01leds_startup start:
        if test "$PREVLEVEL" = N
        then
                previous=S exec /etc/init.d/zleds stop
        fi
        leds boot user
        (Ready/Status: alternating green/amber)

        S99zleds start:
        leds user
        (Ready/Status: green)
        trumpet "k"
                leds beep -l 120; leds beep -l 120; leds beep -l 120

rc[2-5] -> rc[06]
-----------------

rc0:
        K05zleds stop:
        leds boot shutdown
        (Ready/Status: alternating green/amber)

rc[2-5] -> rc1
--------------

rc1:
        K05zleds stop:
        (not removed from /etc/init.d/rc run list because S99zleds exists in 
rc2.d)
        leds boot singleuser
        (Ready/Status: alternating green/amber)

        (x) S01leds_startup start
        (removed from run list because S01leds_startup exists in rc2.d)

        S99zleds start:
        (not removed from run list because K05zleds exists in rc2.d)
        leds singleuser
        (Ready/Status: amber)

rc1 -> rc[2-5]
--------------

rc2:
        K05zleds stop:
        (not removed from run list because S99zleds exists rc1.d)
        leds boot user
        (Ready/Status: alternating green/amber)

        (x) S01leds_startup start
        (removed from run list because S01leds_startup exists in rc1.d)

        S99zleds start:
        (not removed from run list because K05zleds exists in rc2.d)
        leds user
        (Ready/Status: green)
        trumpet "k"
                leds beep -l 120; leds beep -l 120; leds beep -l 120

-- 
Gordon Farquharson
GnuPG Key ID: 32D6D676



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to