[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: invoke-rc.d and rcS scripts



On Mon, 30 Sep 2002, Andreas Metzler wrote:
> On Mon, Sep 30, 2002 at 11:50:22AM -0400, Joey Hess wrote:
> > It seems that if I ask invoke-rc.d to start or stop or restart a script
> > that is only linked in the rcS directory, it always runs the script. I
> > wonder if this is correct behavior?

It always run stop, unless policy-rc.d forbids it.  It will run start and
restart if nothing forbids it.

And the only thing that forbids it by default is a stop symlink in the
current runlevel.

I recall there is some logic to handle "undefined" cases: If there is no
symlink at all (either start or stop), it looks at rcS.d. If there is a
start symlink there, invoke-rc.d allows start/restart.

> It is semi-documented:
> |----invoke-rc.d(8)--------------------
> | invoke-rc.d itself will only pay attention to the  current
> | runlevel, and block any tries to start an init script in a
> | runlevel it is not configured to  be  started  at. 
> 
> This is unclear, "not configured to be started at" has to be
> read as "has been configured to be stopped".

Not really.  The undefined states (no symlink at all) are also an issue.

> > For one thing, this leads to #162801 ...
> 
> rc.S-scripts should probably not be installed with dh_installinit as
> they don't often understand <start> and <stop>, if they did you
> probably could use it but had to add S-entries for 0-6.

It really depends what you want a rcS.d script to _do_.  The runlevel S *is*
special. You never really are at runlevel S, you just go through it during
system init.  Yes, it is ugly. Blame SysV.

I would quite like to define that "start" in rcS.d is to be called once
during system startup, "stop" once during system shutdown (if you are to do
nothing on stop, then just do nothing on stop) -- this makes it much easier
to do a clean implementation of dependencies on init scripts.   It also sort
of groups runlevels S, 0 and 6 together (but they are not the _same_).

We could then have restart be called on package install/upgrade, and stop on
package removal.

Anyway, it looks like debhelper cannot guess what a rcS script needs (right
now, at least).  I think we should document that for runlevel S scripts, it
is better to tell debhelper not to install any code sinippets at all, and do
it by hand.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh



Reply to: