What Happens When the System Is Brought to Run Level 3
The init process is started and reads the /etc/default/init file to set any environment variables. By default, only the TIMEZONE variable is set.
Then init reads the inittab file and does the following:
Identifies the initdefault entry, which defines the default run level (3).
Executes any process entries that have sysinit in the action field so that any special initializations can take place before users login.
Executes any process entries that have a 3 in the rstate field, which matches the default run level, 3.
For a detailed description of how the init process uses the inittab file, see init(1M).
The following table describes the keywords used for run level 3's action field.
Table 11-3 Run Level 3 Action Keyword Descriptions
Key Word
Description
powerfail
Starts the process when the init process receives a power failure signal
respawn
Starts the process and restarts it when it dies
wait
Starts the process and waits for it to finish before going on to the next entry for this run level
The following table describes the processes (or commands) that are executed at run level 3.
Table 11-4 Command Descriptions for Run Level 3
Command or Script Name | Description |
---|---|
/usr/sbin/shutdown | Shuts down the system. The init process runs the shutdown command only if the system has received a power fail signal. |
/sbin/rcS | Mounts and checks root (/), /usr, /var, and /var/adm file systems. |
/sbin/rc2 | Starts the standard system processes and brings the system up into run level 2 (multiuser level). |
/sbin/rc3 | Starts NFS resource sharing for run level 3. |
/usr/lib/saf/sac -t 30 | Starts the port monitors. This process is restarted if it fails. |
/usr/lib/saf/ttymon -g -h -p "`uname -n` console login: " -T terminal_type -d /dev/console -l console | Starts the ttymon process that monitors the console for login requests. This process is restarted if it fails. The terminal_type on a SPARC based system is sun. The terminal_type on an IA based system is AT386. |
Run Control Scripts
The Solaris software environment provides a detailed series of run control (rc) scripts to control run-level changes. Each run level has an associated rc script that is located in the /sbin directory:
rc0
rc1
rc2
rc3
rc5
rc6
rcS
For each rc script in the /sbin directory, there is a corresponding directory named /etc/rcn.d that contains scripts to perform various actions for that run level. For example, /etc/rc2.d contains files that are used to start and stop processes for run level 2.
# ls /etc/rc2.d K03samba* S20sysetup* S72slpd* S88utmpd* K06mipagent* S21perf* S73cachefs.daemon* S89PRESERVE* K07dmi* S30sysid.net* S73nfs.client* S89bdconfig@ K07snmpdx* S40llc2* S74autofs* S90wbem* K16apache* S42ncakmod* S74syslog* S91afbinit* K21dhcp* S47pppd* S74xntpd* S91gfbinit* K26sshd* S69inet* S75cron* S91ifbinit* K27boot.server* S70sckm* S75flashprom* S92volmgt* K28kdc* S70uucp* S75savecore* S93cacheos.finish* K28kdc.master* S71ldap.client* S76nscd* S94ncalogd* K28nfs.server* S71rpc* S77sf880dr* S95IIim* README S71sysid.sys* S80lp* S95svm.sync* S01MOUNTFSYS* S72autoinstall* S80spc* S98efcode* S05RMTMPFILES* S72directory@ S85power* S99audit* S10lu* S72inetsvc* S88sendmail* S99dtlogin* |
The /etc/rcn.d scripts are always run in ASCII sort order. The scripts have names of the form:
[KS][0-9][0-9]*
Files that begin with K are run to terminate (kill) a system service. Files that begin with S are run to start a system service.
Run control scripts are also located in the /etc/init.d directory. These files are linked to corresponding run control scripts in the /etc/rcn.d directories.
The actions of each run control script are summarized in the following section.
Run Control Script Summaries
The following sections summarize the run control scripts that are used to start and stop system services when you change run levels.
The /sbin/rc0 Script
The /sbin/rc0 script runs the /etc/rc0.d scripts to perform the following tasks:
Stops system services and daemons
Terminates all running processes
Unmounts all file systems