|Previous||Table of Contents||Next|
The init state (also called run level ) determines what programs are started or initialized when a system is booted. The SunOS system software has eight init states; the default init state for each system is specified in the /etc/inittab file. The default init state for the SunOS 5.x system software is run level 3. See System Init States shows the seven available run levels and the state of the system at each level.
|1, S, s||System administrator state (single-user)|
|2||Multiuser state (resources not exported)|
|3||Multiuser state (resources exported)|
|4||Alternative multiuser state (currently unused)|
|5||Software reboot state (unused)|
The /sbin/init command is responsible for keeping the system running correctly and is the command you use to change init states. You can also use the init states (with the -i option) as arguments to the shutdown command. There are four types of system states:
When preparing to do a system administration task, you need to determine which init state is appropriate for the system and the task at hand.
To find the run level for a system, type who -r and press Return. The run level, date and time, process termination status, process ID, and process exit status are displayed.
In this example, the system named drusilla is at the default multiuser run level (3), the date and time are Feb 6 15:46, the process termination status is 3, the process ID is 0, and process exit status is S:
drusilla% who -r . run-level 3 Feb 6 15:46 3 Ø S drusilla%
The next sections describe how you might use each init state.
Use this level to shut down the system so that it is safe to turn off the power.
Use this level when performing administrative tasks that require you to be the only user on the system. Root and /usr are the only file systems mounted, and you can access only minimum kernel utilities. The terminal from which you issue the init 1 command becomes the console. No other users are logged in.
Use this level for normal operations. Multiple users can access the system and the entire file system. All daemons are running except for NFS server, syslog, and remote file sharing.
NOTE: A daemon is a special type of program that, once activated, starts itself and carries out a specific task without any need for user input. Daemons typically are used to handle jobs that have been queued, such as printing, mail, and communication.
Use this level for normal operations with NFS resource-sharing available.
This level currently is unavailable.
Use this level when you want to be prompted for a device other than the default boot devices. You can also change to this level using the reboot -a command.
Use this level to shut down the system to run level 0, and then reboot to multiuser level (or to whatever level is the default in the inittab file).
Use this level to run as a single user with all file systems mounted and accessible.
Use either the telinit or init command to change run levels. The telinit command takes a one-character argument that tells init what run level to use. Although you can use the init command directly, telinit is the preferred command to use to change system run states.
To change run levels:
To shut down the system:
oak% su Password: # telinit Ø
To change to single-user state:
oak% su Password: # telinit 1
To change to multiuser state, with no NFS server daemons:
oak% su Password: # telinit 2
To change to multiuser state, with NFS server daemons:
oak% su Password: # telinit 3
To shut down and reboot a system:
oak% su Password: # telinit 6
When preparing to do a system administration task, you need to determine which shutdown command is appropriate for the system and the task at hand. The next sections describe how you might use each of the available shutdown commands:
These commands, respectively, initiate shutdown procedures, kill all running processes, write out any new data to the disk, and shut down the SunOS 5.x system software to the appropriate run level.
Use the shutdown command when shutting down a system with multiple users. The shutdown command sends a warning message to all users who are logged in, waits 60 seconds (the default), and then shuts down the system to single-user state. You can choose a different default wait time.
|Previous||Table of Contents||Next|