Installation guide
See the rc0(8) reference page for additional information.
4.1.2.3 The rc2.d Directory and rc2 Run Command Script
The /sbin/rc2 script contains run commands that enable initialization of
the system to a nonnetworked multiuser state, run level 2. As described
previously, the inittab file contains entries that the init program reads
and acts on when the system is booting or changing its state to run level 2.
For example:
s2:23:wait:/sbin/rc2 < /dev/console > /dev/console 2>&1
Notice that the rc2 script is the specified command. In addition to
commands listed in the script itself, rc2 contains instructions to run
commands found in the /sbin/rc2.d directory. These commands are
linked to files in the init.d directory. The script defines the conditions
under which the commands execute; some commands run if the system is
booting, other commands run if the system is changing run levels.
By convention, files in the /sbin/rc2.d directory begin with either the
letter "K" or the letter "S" and are followed by a 2-digit number and a file
name. For example, a listing of the /sbin/rc2.d directory contents would
look similar to the following:
lrwxr-xr-x 1 root staff 13 Jan 04 10:44 K00lpd -> ../init.d/lpd
lrwxr-xr-x 1 root staff 13 Jan 04 10:51 K03lat -> ../init.d/lat
lrwxr-xr-x 1 root staff 15 Jan 04 10:37 K05inetd -> ../init.d/inetd
lrwxr-xr-x 1 root staff 15 Jan 04 10:37 K10snmpd -> ../init.d/snmpd
lrwxr-xr-x 1 root staff 15 Jan 04 10:37 K15xntpd -> ../init.d/xntpd
lrwxr-xr-x 1 root staff 14 Jan 04 10:31 K20cron -> ../init.d/cron
lrwxr-xr-x 1 root staff 18 Jan 04 10:31 K30sendmail -> ../init.d/sendmail
lrwxr-xr-x 1 root staff 13 Jan 04 10:41 K35nfs -> ../init.d/nfs
lrwxr-xr-x 1 root staff 18 Jan 04 10:41 K40nfsmount -> ../init.d/nfsmount
lrwxr-xr-x 1 root staff 13 Jan 04 10:37 K43nis -> ../init.d/nis
lrwxr-xr-x 1 root staff 15 Jan 04 10:41 K45named -> ../init.d/named
lrwxr-xr-x 1 root staff 14 Jan 04 10:37 K47rwho -> ../init.d/rwho
lrwxr-xr-x 1 root staff 15 Jan 04 10:37 K48route -> ../init.d/route
lrwxr-xr-x 1 root staff 17 Jan 04 10:37 K49gateway -> ../init.d/gateway
lrwxr-xr-x 1 root staff 16 Jan 04 10:31 K50syslog -> ../init.d/syslog
lrwxr-xr-x 1 root staff 14 Jan 04 10:52 K51uucp -> ../init.d/uucp
lrwxr-xr-x 1 root staff 14 Jan 04 10:37 K55inet -> ../init.d/inet
lrwxr-xr-x 1 root staff 15 Jan 04 10:31 K57quota -> ../init.d/quota
lrwxr-xr-x 1 root staff 18 Jan 04 10:31 S00savecore -> ../init.d/savecore
lrwxr-xr-x 1 root staff 16 Jan 04 10:31 S05paging -> ../init.d/paging
lrwxr-xr-x 1 root staff 19 Jan 04 10:31 S10recpasswd -> ../init.d/recpasswd
lrwxr-xr-x 1 root staff 14 Jan 04 10:52 S15uucp -> ../init.d/uucp
lrwxr-xr-x 1 root staff 17 Jan 04 10:31 S25enlogin -> ../init.d/enlogin
In general, the system starts commands that begin with the letter "S" and
stops commands that begin with the letter "K." Commands that begin with
the letter "K" run only when the system is changing run levels from a
higher to a lower level. Commands that begin with the letter "S" run in all
cases. The numbering of commands in the /sbin/rc2.d directory is
important since the numbers are sorted and the commands are run in
ascending order.
Customizing the System Environment 4–11