Objective 2: Change Runlevels and Shut Down or Reboot System
As mentioned in the introduction, Linux and many Unix systems share the concept of runlevels. This concept specifies different ways a system can be used by controlling which services are running. For example, a system that operates a web server program is configured to boot and initiate processing in a runlevel designated for sharing data, at which point the web server is started. However, the same system would not run the web server in a runlevel used for emergency administration, when all but the most basic services are shut down.
Runlevels are specified by the integers through 6 as well as a few single characters. Runlevels 0 and 6 are unusual in that they specify the transitional states of shutdown and reboot, respectively. By instructing Linux to enter runlevel 0, it begins a clean shutdown procedure. Similarly, the use of runlevel 6 begins a reboot. The remaining runlevels differ in meaning slightly among Linux distributions and other Unix systems.
When a Linux system boots, the init process is responsible for taking the system to the default runlevel, which is usually either 2, 3, or 5 depending on the distribution and the use for the machine. Typical runlevel meanings are listed in Table 14-1.
Table 14-1. Typical runlevels
Runlevel |
Description |
---|---|
0 |
Halt the system; runlevel 0 is a special transitional device used by administrators to shut down the system quickly. This, of course, shouldn't be a default runlevel, because ... |
Get LPI Linux Certification in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.