Stephen Gran on 10 Jan 2004 16:07:01 -0000


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

Re: [PLUG] How to find parent in the shell?


On Sun, Jan 04, 2004 at 11:11:19PM -0500, Stephen Gran said:
> Somebody (Bruce Perens, of all people :) recently submitted a bug
> report against one of my packages (hdparm), asking that it not be run
> automatically except at boot up.  The problem I'm having now is to
> figure out how to figure out if it's being called at boot, or by dpkg
> on upgrade, or by hand.

Just for the archives, Debian already solved this problem by creating a
wrapper that calls init scripts. It's called invoke-rc.d, and it's logic
is roughly the following: If you have a K link in the runlevel you're
currently in, it will not run.  If you have an S link in either the
runlevel you're currently in or in rcS.d (but no K in either) the script
will run.

So my problem was solved by shipping only one S link in rcS.d, and a K
link in all other runlevels.  Now the admin can run the script by hand,
but it will not be run on upgrade.  Phew.  Thanks for everybody's help.

-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | If you go on with this nuclear arms     |
|  steve@lobefin.net             | race, all you are going to do is make   |
|  http://www.lobefin.net/~steve | the rubble bounce.   -- Winston         |
|  			         | Churchill                               |
 --------------------------------------------------------------------------

Attachment: pgp3xDKEviRGv.pgp
Description: PGP signature