DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Customizing UNIX system startup

Changing scripts in /etc/rc2.d

Upon entering init state 2 (multiuser mode) from either a higher init state (3-6) or from single-user mode, init executes the /etc/rc2 script according to the instructions in /etc/inittab. The rc2 script sets certain environment variables and runs scripts in the /etc/rc2.d directory. Some of the scripts in rc2.d run scripts in subdirectories of the rc.d directory.

This section describes the scripts in the /etc/rc2.d directory that are run by rc2 and explains the steps for adding your own script. The rc2(ADM) manual page describes the other scripts that rc2 runs.

``/etc/rc2.d scripts'' gives a brief description of some of the scripts in /etc/rc2.d.

/etc/rc2.d scripts

Script Description
S00MDAC starts Mylex disk array monitor
P00SYSINIT starts kernel message logger
S00VDISK configures virtual disk arrays
I01MOUNTFSYS mounts filesystems specified in /etc/default/filesys
P03RECOVERY tidies up vi editing sessions after a crash
P04CLEAN removes temporary files
P05RMTMPFILES removes temporary files
P15HWDNLOAD downloads hardware
P16KERNINIT starts, process accounting, network, and other kernel initialization
P20sysetup configures print system and generates /etc/systemid
P21perf starts system accounting
S25pm starts power management event routing and servicing daemon
S35dlpi configures the network card driver interface
P70uucp cleans up UUCP lock files
P75cron starts cron daemon
S80lp starts lpsched and net utilities
S85tcp starts TCP/IP, name service, and routing
P86mmdf starts mmdf deliver daemon
P86scologin starts scologin
P87USRDAEMON starts user daemons
P88USRDEFINE executes user-definable commands after boot
S89hostmib starts host MIB service
S89nfs starts NFS service
P90RESERVED mails fsck output saved during autoboot to root
S95calserver starts calendar daemon
S95docview starts DocView Apache server
S99apcssd starts UPS port monitor

The /etc/rc2.d directory on your system may contain scripts other than the ones listed in the table. This is because during installation, many add-on programs insert their own daemon-initialization scripts in this directory. This directory may also include scripts that clean up the temporary or lock files for an add-on program.

You can write your own scripts to run when the system enters init state 2. For example, you can write a script that sets up a RAM disk or starts a network and add it to /etc/rc2.d.

The following factors should be considered when writing a system startup script to be placed in rc2.d :

To add a function to the initialization procedure:

  1. Write a script that performs the desired function.

  2. Test the script to make certain it behaves as expected. Be sure any environment variables used in the script are defined at startup.

  3. Name the file so that it begins with the uppercase letter ``P'', ``S'', ``I'', or ``K'' followed by a two-digit number indicating the order in which it should be executed relative to the other files in the directory, and ends with a name that describes the script's function. For example, S80lp handles print service startup. It will be executed after any script that begins with S79, and before any that begins with S81. You must follow this naming convention to ensure that your script is executed at the proper time.

    Note that a set of scripts whose names start with P77, P78, and P79 will be executed concurrently. S80lp will not start until they have all exited.

  4. Copy the script into the /etc/rc2.d directory so that it is executed by rc2 when the system enters (or leaves) multiuser mode.
If the function that you want to add is in the same category as functions performed by a script already located in /etc/rc2.d, simply edit the existing script to add the new function. For example, you can add a function related to UUCP to the file P70uucp. You can also edit any script to tailor it to your needs. For example, to start process accounting, remove the appropriate comments from the P16KERNINIT file. Remember to back up the original script before modifying it.
Next topic: Starting daemons on a trusted system
Previous topic: inittab powerfail keywords

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003