rc Script Failure

Gerard Beekmans gerard at linuxfromscratch.org
Tue Jun 13 16:02:49 PDT 2000


> When version 2.3.3 of the book came out, there was a change in
> the rc script.  This change prevents rc0.d or rc6.d from 
> killing something started by rcS.d

Problem sorted out (I hope).

The new rc script doesn't run a K script unless there is an S script in
the previous run level. This means that if you have, for example, a
K20sendmail in rc0.d but there is no S20sendmail in rc3.d (or whatever
run level you came out of) it won't kill sendmail. The problem as you
found is that the N (sysinit) run level isn't the previous level but the
one before it (you go from N to to 3 and to 0 or 6 when you shutdown)
and rc doensn't know about it yet. It can easily be fixed the following
way. Note that I haven't tested this yet (I will test it tomorrow) but I
don't see why this shouldn't work.

Find these lines in the current rc script:

suffix=${i#/etc/rc$runlevel.d/K[0-9][0-9]}
previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix

# Stop the service if there is a start script
# in the previous run level.
[ ! -f $previous_start ] || && continue

startup $i stop
done
fi

-------

Replace those lines by:

suffix=${i#/etc/rc$runlevel.d/K[0-9][0-9]}
previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
sysinit_start=/etc/rcS.d/S[0-9][0-9]$suffix

# Stop the service if there is a start script
# in the previous run level.
[ ! -f $previous_start ] || || [ ! $sysinit_start ] && continue

startup $i stop 
done 
fi   
#end

That should do it I believe.

-- 
Gerard Beekmans
www.linuxfromscratch.org

-*- If Linux doesn't have the solution, you have the wrong problem -*-
--
Mail archive: http://www.pcrdallas.com/mail-archives/lfs-discuss
IRC access: server: irc.linuxfromscratch.org port: 6667 channel: #LFS
News Reader access: news.pcrdallas.com
Unsubscribe: email lfs-discuss-request at linuxfromscratch.org and put
"unsubscribe" (without the quotation marks) in the body of the message
(no subject is required)



More information about the lfs-dev mailing list