Local rc scripts (was: Software installation opinions needed)

Robert Claeson prc at erbe.se
Sun Sep 30 21:24:21 AEST 1990


In a recent article peter at ficc.ferranti.com (Peter da Silva) writes:

>The System V startup model might repay study.
>
>	inittab ---> /etc/rc0
>		     /etc/rc2 ---> /etc/rc2.d/S01MOUNTFSYS
>				   /etc/rc2.d/S05RMTMPFILES
>				   ...

>Run level 2 starts up all the multiuser stuff. Run level 3 is typically used
>for the network level. An application program just needs to install a startup
>file in /etc/rc?.d and it is automatically initialised.

Actually, the /etc/init.d directory contains all the startup/shutdown
files, like MOUNTFSYS, ethernet, sendmail, acct, nfs and the like. Each
of these scripts are built around a switch, and accepts either "start"
or "stop" as arguments on the command line.

"Start" starts all the daemons and performs any other tasks needed to
start a service. Likewise, "stop" kills any started daemons and shuts
down the service.

Each of these scripts are then linked to /etc/rc0.d, /etc/rc1.d,
/etc/rc2.d etc with names in the form "[SK][0-9][0-9]<name>".
The scripts /etc/rc0, /etc/rc1 etc (one for each run level, 0-6)
first runs all K?? scripts in ascending order and then all S??
scripts, also in ascending order. Scripts starting with "K" gets
a "stop" passed on the command line while scripts starting with
"S" gets a "start" on the command line.

At this site, all we do to install a new service (say, Ingres,
Informix, the Annex terminal server software etc) is to create
a new script in /etc/init.d (all locally added scripts starts
with local-<name>. This is typically done by copying and modifying
an existing locally added script.

All scripts in /etc/init.d are then *linked* to the other startup
directories (ie, /etc/init.d/nfs gets linked to /etc/rc3.d/S85nfs
and to /etc/rc0.d/K05nfs):

# cd /etc
# ln init.d/local-ingres rc2.d/S98local-ingres
# ln init.d/local-ingres rc0.d/K01local-ingres

Note that all locally added scripts are assigned numbers so that
they will be run first in the shutdown sequence and last in the
startup sequence.

The System V method of performing start-up is one of the cleanest and
at the same time flexible ways I've seen among all UNIX systems.

-- 
Robert Claeson                  |Reasonable mailers: rclaeson at erbe.se
ERBE DATA AB                    |      Dumb mailers: rclaeson%erbe.se at sunet.se
                                |  Perverse mailers: rclaeson%erbe.se at encore.com
These opinions reflect my personal views and not those of my employer.



More information about the Comp.unix.admin mailing list