Subject: Re: Updating /etc...
To: Rob Healey <rhealey@altair.helios.mn.org>
From: Matt Ragan <matt@ibmoto.com>
List: current-users
Date: 12/20/1995 10:50:32
Rob Healey wrote:
>
>> It evades me why people in the System V world decided that each
>> package should have its own startup/shutdown script in /etc.  Why does
>> all that hair belong in /etc, instead of in the executables for the
>> packages themselves?
>> 
>	Have you worked at a large UNIX site? There is a reason why LARGE
>	sites like /etc/init.d, it's not just dumb luck. In a nutshell:

I work at a 'large UNIX site', and personally, I don't like the /etc/init.d
(or others' /etc/rc.d).  However, as much bashing as AIX deserves in general,
something akin to AIX's inittab might not be a Bad Thing(tm).  

Note that the following is not AIX's implementation, but is somewhat
loosely based on it:

In /etc, you would have a file that would have the following format:

package name:start command

The 'package name' is simply a label, and the 'start command' should be
fairly obvious.  In /etc/rc or /etc/rc.local, you would have a place to
go through the file starting each of your packages, either with a shell
function or an external command, depending on implementation.  An
external command would probably be more useful, since then you could
manually start something after this system is up with the same way it
would be done in the rc files.

If you wanted to get fancy and more configurable, you could extend it
to something like:

package name:subsystem:start command:shutdown command

In this case, you can call the startup command multiple times throughout
your rc files to start things in different places, if you need to.  For
example, start the 'net' subsystem in one place, and then later start
the 'nfs' subsystem.  The subsystem would be optional, so that at
the end of /etc/rc, you would call the startup command to start the
remaining packages that do not have a subsystem.  The start command
should also be able to take a package name, rather than a subsystem
name, to be able to start a specific package; this would be more
useful for starting things manually while in multiuser.

The shutdown command could be used within /sbin/shutdown (or, more
likely, a frontend shell script) to do special shutdowns for the
packages that need them, for example, a database.  It would be an
optional field, since not everything needs special shutdowns.

This gives you a number of things:

a) it's a file, not a directory, so you don't have a directory structure
   underneath /etc.

b) you can order your packages within each subsystem to have them start
   up in the order you want them to, which is much more difficult to do
   in the 'file in a directory' concept that init.d uses; you end up with
   lovely file names like S88nfs.

c) install packages can insert the appropriate startup line into the
   file easily to get automatically run on startup/shutdown, and removal
   packages can easily remove them by keying off of the package name in
   the file

d) it's optional.  If you don't want to use it, put your stuff in /etc/rc
   or /etc/rc.local as you did previously, and it will work the same as
   it did before.

-- 
--------------------------------------------------------------------------
Matt Ragan  (matt@ibmoto.com)  Motorola/IBM Somerset PowerPC Design Center
Network Administrator          Systems/Network Engineering  (512) 795-7298
9737 Great Hills Trail         Austin, Tx  78759        FAX (512) 795-7519
--------------------------------------------------------------------------