Next | Prev | Up | Top | Contents | Index

Entering the Multiuser State from System Shutdown

When your system is up and running, it is usually in multiuser mode. It is only in this mode that the full power of IRIX is available to your users.


Powering Up the System

When you power up your system, it enters multiuser mode by default. (You can change the default by modifying the initdefault line in your inittab file.) In effect, going to the multiuser state follows these stages (see Table 3-1, " System States,"):

  1. The operating system loads and the early system initializations are started by init.

  2. The run level change is prepared by the /etc/rc2 procedure.

  3. The system is made public through the spawning of getty processes along the enabled terminal lines.

Early Initialization

Just after the operating system is first loaded into physical memory through the specialized boot programs that are resident in the PROM hardware, the init process is created. It immediately scans /etc/inittab for entries of the type sysinit:

fs::sysinit:/etc/bcheckrc </dev/console >/dev/console 2>&1 
mt::sysinit:/etc/brc </dev/console >/dev/console 2>&1 
These entries are executed in sequence and perform the necessary early initializations of the system. Note that each entry indicates a standard input/output relationship with /dev/console. This establishes communication with the system console before the system is brought to the multiuser state.


Preparing the Run Level Change

Now the system is placed in a particular run level. First, init scans the table to find an entry that specifies an action of the type initdefault. If it finds one, it uses the run level of that entry as the tag to select the next entries to be executed. In our sample /etc/inittab, the initdefault entry is run level 2 (the multiuser state):

is:2:initdefault: 
s2:23:wait:/etc/rc2 >/dev/console 2>&1 </dev/console 
co:23:respawn:/etc/gl/conslog 
t1:23:respawn:/etc/getty -s console ttyd1 co_9600 #altconsole
t2:23:off:/etc/getty ttyd2 co_9600 # port 2 
t3:23:off:/etc/getty ttyd3 co_9600 # port 3 
t4:23:off:/etc/getty ttyd4 co_9600 # port 4 
The other entries shown above specify the actions necessary to prepare the system to change to the multiuser run level. First, /etc/rc2 is executed. It executes all files in /etc/rc2.d that begin with the letter S, accomplishing (among other things) the following:

init then starts a getty for the console and starts getty on the lines connected to the ports indicated.

At this point, the full multiuser environment is established, and your system is available for users to log in.


Changing Run Levels

To change run levels, the system administrator enters a command that directs init to execute entries in /etc/inittab for a new run level, such as multi, single, or reboot. Then key procedures, such as shutdown, /etc/rc0, and /etc/rc2, are run to initialize the new state.

The new state is reached. If it is state 1 (single-user mode), the system administrator can continue.


Run-level Directories

Run levels 0, 2, and 3 each have a directory of files that are executed in transitions to and from that level. These directories are rc0.d, rc2.d, and rc3.d, respectively. All files in these directories are linked to files in /etc/init.d. The run-level file names look like this:

S00name

or

K00name

The filenames can be split into three parts:

S or K

The first letter defines whether the process should be started (S) or killed (K) upon entering the new run level.

00

The next two characters are a number from 00 to 99. They indicate the order in which the files will be started (S00, S01, S02, etc.) or stopped (K00, K01, K02, etc).

name

The rest of the filename is the /etc/init.d filename to which this file is linked.
For example, the init.d file cron is linked to the rc2.d file and rc0.d file S75cron. When you enter init 2, this file is executed with the start option: sh S75cron start. When you enter init 0, this file is executed with the stop option: sh K70cron stop. This particular shell script executes /sbin/cron when run with the start option and kills the cron process when run with the stop option.

Because these files are shell scripts, you can read them to see what they do. You can modify these files, though it is preferable to add your own since the delivered scripts may change in future releases. To create your own scripts, follow these rules:

Note that it may prove easier to simply copy an existing script from the directory and make appropriate changes.


Going to Single-user Mode From Multiuser Mode

Sometimes you must perform administrative functions, such as backing up the root file system, in single-user mode.

Use the shutdown command. This procedure executes all the files in /etc/rc0.d by calling the /etc/rc0 procedure. The shutdown command does the following things, among others:

The entries for single-user processing in the sample /etc/inittab are:

s1:1:wait:/etc/shutdown -y -iS -g0 >/dev/console 2>&1 </dev/console 
There are three recommended ways to start the shutdown to single-user mode:

  1. You can enter the shutdown -i1 command (recommended). The option -g specifies a grace period between the first warning message and the final message.

  2. You can enter the single command, which runs a shell script that switches to single-user mode and turns the getty processes off.

  3. You can enter the init 1 command, which forces the init process to scan the table. The first entry it finds is the s1 entry, and init starts the shutdown processing according to that entry.
Now the system is in the single-user environment, and you can perform the appropriate administrative tasks.


/etc/inittab and Power Off

The following entries in /etc/inittab power off the system:

s0:06s:wait:/etc/rc0 >/dev/console 2>&1 </dev/console 
of:0:wait:/etc/uadmin 2 0 >/dev/console 2>&1 </dev/console 
Always attempt to shut the system down gracefully. You can either enter the powerdown command, the init 0 command, or directly invoke the /etc/shutdown -i0 command.

In either case, the /etc/shutdown and /etc/rc0 procedures are called to clean up and stop all user processes, daemons, and other services and to unmount the file systems. Finally, the /sbin/uadmin command is called, which indicates that the last step (physically removing power from the system) is under firmware control.

Chapter 4 provides information on general system configuration. These tasks include setting most system features:

Chapter 4


Next | Prev | Up | Top | Contents | Index