Subject: Re: Updating /etc...
To: Allen Briggs <briggs@puma.bevd.blacksburg.va.us>
From: Wes Hardaker <hardaker@ece.ucdavis.edu>
List: current-users
Date: 12/21/1995 08:44:12
Well, I hesitate to get involved in this subject, however, I thought
I'd throw out this suggestion:

Allen Briggs <briggs@puma.bevd.blacksburg.va.us> writes:

|> 	Cons:
|> 		- It makes no provision for handling the running of
|> 		  shutdown scripts of any kind

Well, it does if you use something like the OSF/1 scheme (requires
runlevels) where every script has either a start or stop argument.
The scripts are then linked into appropriate run level kill and start
script directories.  When exiting a run-level (ie, on shutdown or a
simple change), all the kill scripts get executed with a 'stop'
argument.

|> 		- It does not allow programs to run inbetwixt other
|> 		  parts of the system startup  (How many products
|> 		  really need this?)

Many people have suggested some sort of 'make' or 'dependency' type
clauses to be put in the script files.  This is probably a good idea.
Another one, which might be much easier to maintain, is to a
hierarchial directory scheme:

([dx]- Name:  d = directory, x = script, Name = duh)

d- PkgA
  x- PkgA
  d- PkgB
     x- PkgB
  d- PkgC
     x- PkgC
  x- PkgD

That way, you can simply:

runinits()
{
  for i in $STARTDIR/*
  do
    if [ -d $i ]; then
      OSTARTDIR=$STARTDIR
      STARTDIR=$STARTDIR/$i
      runinits
      STARTDIR=OSTARTDIR
    fi
  done

  for i in $STARTDIR/*
  do
    if [ -x $i -a `basename $STARTDIR` != `basename $i` ]; then
      $i
    fi
  done

  if [ -x $STARTDIR/`basename $STARTDIR` ]; then
    $STARTDIR/`basename $STARTDIR`
  fi
}

STARTDIR=/etc/init.d/[runleveldir-if-were-going-to-use-runlevels]
runinits


This way the execution order of the above set goes:

PkgA/PkgB/PkgB
PkgA/PkgC/PkgC
PkgA/PkgD
PkgA/PkgA

which ensures that PkgB and PkgC are run before PkgA and doesn't
require a global file like a makefile would, or require that each
script put dependancies in their script as comments for init/whatever
to parse.  

Just more ideas to fling around.  The more I think about this one,
however, the more I like it.

Wes