Chapter 11: System V NERC boot enhancements
Run Levels

All the operating systems used in NERC except for SunOS are of the System V type.A basic tenet of System V is the 'run level', where a system can be in any one of perhaps 6 run levels, each of which has clearly defined properties. For example run level 1 is usually single user state, and 0 is usually halted. The functionality of the system generally increases with run level up to 3 or 4. The actions taken while going from one level to the next are specified by a file called /etc/inittab. This differs slightly between manufacturers but always consists of a number of lines each having the format


Here id indentifies this entry, rstate defines the run level at which the action is to be performed ( which may be a list of several run levels), and action is what happens while the process is being performed. For example

s2:234:wait:/sbin/rc2 > /dev/console

on a Solaris machine indicates that moving to run level 2 requires the execution of the script /sbin/rc2 ( and the output comes to the console).

The file /sbin/rc2 is a shell script which run all the files in the directory /sbin/rc2.d according to certain rules which are explained in detail below.

Back to contents

Location of startup scripts

The startup scripts named in /etc/inittab vary in location between architectures.

The following table shows for each architecture the script named in /etc/inittab, the directory or directories where the proprietary startup scripts live, and the name of the extra script used to start the NERC startups ( see next section).

Architecture Default script Directory of startups NERC script
Solaris /sbin/rc2 /etc/rc2.d /sbin/rc4.nerc
HPUX-10.20. /sbin/rc /sbin/rc2,3,4.d /sbin/rc4.nerc
DEC Unix /sbin/rc2,rc3 /sbin/rc2.d /sbin/rc4.nerc
Silicon Graphics /etc/rc2 /etc/rc2.d /etc/rc4.nerc


NERC startup sequences

The NERC UNIX customisation involves modifications to the penultimate run level to start the automounter in a non-default way, and uses the final run level to execute our own scripts (the names of which are given in the table above), for anything which is required to be run during bootup, such as licence manager startups or the network command to add a default route. BSD Unix systems execute /nerc/etc/rc4.nerc as the last step in their existing /nerc/etc/rc.nerc script to emulate this System V startup.

The automounter startup modifications will vary from time to time with new versions of the operating systems; they are part of /nerc/scripts and are not covered further here.

There are two possible locations for the NERC startup scripts; these are/nerc/bin/rc.d and /nerc/etc/rc.d. Remember that /nerc/etc is common to all architectures and there is a separate /nerc/bin for each architecture. Some examples of the contents of /nerc/etc/rc.d are:

S06networker_client S40oracle.csh

Here the scripts are to start up the Legato Networker client software, an ORACLE database, and the ARC/INFO licence manager. The scripts themselves are usually very simple, as shown by:

Back to contents


if [ -f /nerc/packages/networker/current/client_startup ]; then

For more examples cd to /nerc/etc/rc.d, or /nerc/bin/rc.d on any architecture, and have a look at the scripts there.

NERC shutdown sequences

Some applications need to be shut down cleanly; the scripts for these can be put in /etc/rc0.d ( on most System V systems ) or in /etc/shutdown on HPUX 9.x.SunOS has no equivalent. An example of this is K40oracle, which shuts down an Oracle database. It should be noted that /etc/rc0.d is not executed on reboot, only on full shutdown.

Startup file name conventions


The System V startup script naming convention is as follows:

File name definition: <K|S><number><name>[.csh|.sh|.*]

<K|S> All startup scripts must begin with a K or an S.

Scripts beginning with a K which are executed in their own shell(see below) will be passed the argument "stop", and scripts begining with S, executed in their own shell, will be passed the argument "start". The arguments can be ignored. <number> A number at this point in the filename dictates the order in which the scripts are executed. The execution order is really alphabetical but a number makes it easier to comprehend.


<name> An informative name eg. oracle. Two scripts with the same number will be run in alphabetical order of this name. NERC extended startup file name suffix conventions


Scripts with no 'file type' or a file type other than .csh or .sh are executed in their own Bourne shell. Files ending in .csh will be executed in their own C shell and scripts ending in .sh will be 'sourced' and executed in the boot sequence Bourne shell. The final option, .sh, is not recommended because of the risk of hanging the boot sequence. Note that the .csh option is a NERC extension; shutdown scripts to be placed in /etc/rc0.d should have no extension.
Back to contents

Controlling which hosts run the NERC startup scripts

By default none of the startup scripts found in /nerc/etc/rc.d or /nerc/bin/rc.d will be executed; this allows the startup scripts to be 'rdisted' to all sites from the master NERC FS without causing problems. The 'rdisting' will be done in verify mode first to discover any 'home-grown' startups in /nerc/etc/rc.d or /nerc/bin/rc.d; if they have the same name as an 'official' startup script the two will need to be reconciled and possibly one of them renamed.

To activate a startup script there must be a file in /nerc/<domainname>/startups with exactly the same name as the startup script to be executed. If the file in /nerc/<domainname>/startups is empty then the startup script will be run on all hosts in the domain; if the file has a list of host names, separated by spaces or line-feeds, then the startup script will only be executed on the named hosts.

This page last updated February 18th 1998 by