rc2(ADM) 19 June 1992 rc2(ADM) Name rc2 - run commands performed for multiuser environment Syntax /etc/rc2 Description This file is executed via an entry in /etc/inittab and is responsible for those initializations that bring the system to a ready-to-use state, traditionally state 2, called the ``multiuser'' state. The actions performed by /etc/rc2 are found in files in several direc- tories and are executed in a prescribed order to ensure proper initiali- zation. /etc/rc2 performs the following functions in the order in which they appear: 1. Runs the script /etc/conf/bin/idmkenv. This script sets up the new kernel environment if a new kernel has been configured, calls idmk- init to rebuild the /etc/inittab file, and links files to the /etc/idrc.d and /etc/idsd.d directories to be run by /etc/rc2. 2. Runs the system setup scripts in the directory /etc/rc2.d. Some of the scripts in this directory are front-end scripts to run other scripts in the subdirectories of /etc/rc.d. 3. Runs system setup scripts in the directory /etc/rc.d. This directory exists for XENIX compatibility. It contains subdirectories named with the numerals 0 to 9. Each subdirectory contains scripts that perform certain system startup functions (for example, the directory /etc/rc.d/3 contains scripts that handle crash recovery). All of these scripts are run by the front-end scripts in /etc/rc2.d. Any other individual scripts in the directory are run. 4. Runs the system setup scripts in the directory /etc/idrc.d, which contains scripts from the driver packages linked from /etc/conf/rc.d. 5. Runs the scripts in /etc/idsd.d, which contains shutdown scripts linked from /etc/conf/sd.d. 6. Runs the script /etc/rc. This script exists for XENIX compatibility. It is an empty file, but you can add initialization commands to the file. These commands are run last during the initialization. The setup scripts are executed by /bin/sh in ASCII sort-sequence order (see ``Files'' for more information). When functions are added that need to be initialized when the system goes multiuser, an appropriate file should be added in /etc/rc2.d. Other functions can be added, as required, to support the addition of hardware and software features. Examples The following are prototypical files found in /etc/rc2.d. These files are prefixed by an S and a number indicating the execution order of the files. MOUNTFSYS # Set up and mount file systems cd / /etc/mountall uucp # clean up uucp locks, status, and temporary files rm -rf /usr/spool/locks/* /etc/rc2 also sets certain environment variables, including the TZ vari- able, by reading /etc/TIMEZONE, thus establishing the default environment for all commands that follow. Files Here are some hints about files in /etc/rc.d: The order in which files are executed is important. Since they are exe- cuted in ASCII sort-sequence order, the first character of the filename is a sequence indicator that helps keep the proper order. Thus, files starting with the following characters would run accordingly: [0-9] very early [A-Z] early [a-n] later [o-z] last Files in /etc/rc.d that begin with a dot (.) will not be executed. This feature can be used to hide files that are not to be executed for the time being without removing them. Files in /etc/rc2.d must begin with an S or a K followed by a number and the rest of the filename. Upon entering run level 2, files beginning with S are executed with the start option; files beginning with K are executed with the stop option. Files beginning with other characters are ignored. Notes This file is intended for execution by init. It must never be executed directly by a user. See also shutdown(ADM), init(M), rc0(ADM) ``Starting and stopping the system'' in the System Administrator's Guide