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

Re: Daemon init scripts and apt-get [was: Re: red worm amusement]



Mike Fedyk <mfedyk@matchmail.com> writes:

> On Sun, Jul 22, 2001 at 03:27:10AM -0400, Steven Barker wrote:
> > On Sat, Jul 21, 2001 at 11:59:17PM -0700, Mike Fedyk wrote:
> > > On Sun, Jul 22, 2001 at 02:50:14AM -0400, Steven Barker wrote:
> 
> > > Personally, I think there should either be a /etc/do-not-start/<package> dir that
> > > packages' init scripts check for non-existance before starting, or a
> > > commented entry in the config file that the init script checks for
> > > non-existance before starting...
> > 
> > Well, now we're getting into heavy policy stuff....  I think it would be hard
> > enough to get all the daemon postinst scripts to work in run and no-run mode.
> 
> Actually, if we could get them all to source an sh script that
> contains that logic, all changes to policy would be self-contained.

I think I've shot this one out before, but...

Why not use something like the IRIX ``chkconfig'' system: Provide a
simple program that takes the ``name'' of a service and then checks an
external file/files for ``on'' or off status of each service, and
returns 0 if on, 1 if off.  Then have each init.d script do something
like:

  case "$1" in
    'start')
      if /etc/chkconfig myservice; then
        ...
        start myservice
        ...
      fi

[In IRIX, the /etc/config directory has a file for each name chkconfig
knows about that contains either ``on'' or ``off'' so adding a new
service is as simple as `echo "on" > /etc/config/newservice`, though
IRIX actually allows viewing and changing things with the chkconfig
program itself (eg, `chkconfig` with no arguments lists every service
known to chkconfig, `chkconfig service on|off` changes the state of a
service, with a -f flag to ``force'' creation of a new service.)]

This prevents ``uptdate surprises'' since updating everything
including the init.d script doesn't change the on|off status of the
service in the config directory.  Of course it also means putting the
above bit of logic in every init.d script that is put under chkconfig
control and adding the necessary logic to the postinst script to
create the config entry if it doesn't exist yet...




-- 

/*  Dale Southard Jr.       southard1@llnl.gov        925-422-1463  */
/*  Computer Scientist, Accelerated Strategic Computing Initiative  */
/*  L-550,  Lawrence Livermore National Lab,  Livermore CA   94551  */
/*  AFF/I, SL/I, T/I, D-11216, Sr. Rig --- I'd rather be skydiving  */



Reply to: