Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucsd!usc!snorkelwacker!bloom-beacon!eru!hagbard!sunic!maxim!prc From: prc@erbe.se (Robert Claeson) Newsgroups: comp.unix.admin Subject: Re: Local rc scripts (was: Software installation opinions needed) Message-ID: <1816@hulda.erbe.se> Date: 30 Sep 90 11:24:21 GMT References: <24601@uflorida.cis.ufl.EDU> Organization: ERBE DATA AB, Jarfalla, Sweden Lines: 56 In a recent article peter@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]". 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-. 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@erbe.se ERBE DATA AB | Dumb mailers: rclaeson%erbe.se@sunet.se | Perverse mailers: rclaeson%erbe.se@encore.com These opinions reflect my personal views and not those of my employer.