The runlevel used when starting the Linux system is defined in the /etc/ inittab file. PowerPoint PPT Presentation

Download Presentation

The runlevel used when starting the Linux system is defined in the /etc/ inittab file.

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

Presentation Transcript

A runlevel is a mode of operation of the Linux OS, that provides a particular set of services. Table 4-5 shows the standard runlevels for most Linux systems, with a brief description of how each is used. The numbers associated with each runlevel's functionality may vary somewhat from one distribution to another.

Kennesaw State University

The runlevel used when starting the Linux system is defined in the /etc/ inittab file.

The init program launches the rc script located in the /etc/rc.d directory, with a parameter that includes the runlevel to use.

The rc script then starts the appropriate system services based on the selected runlevel.

A subdirectory exists for each runlevel, located in the /etc/rc.d directory. For example, the directories /etc/rc.d/rc3.d include files that control which system services are used in runlevel 3. Runlevel subdirectories, such as /etc/rc.d/rc3.d, contain files that indicate which services are to be started or stopped when using that runlevel.

Each file in these runlevel directories begin with a K or an S, followed by a two-digit number.

The number indicates the order in which services are started or stopped.

Services that begin with a K, are stopped (killed);

Services that begin with an S are started.

Some contents of a typical directory are shown here:

Sllportmap S60nfs K20rstatd S15netfs S85sound

Kennesaw State University

The initialization of each of these services includes another level of complication. The files you see in the runlevel subdirectories are pointers to scripts that stop and start the services.

Example:If you use the ls -l command to see a long listing of the HTTP service in the /etc/rc. d/rc3.d subdirectory, you see that the S85httpd file is actually a pointer to another file: /etc/rc.d/init.d/httpd.

Because the file (the pointer) in the /etc/rc.d/rc3.d subdirectory contains a leading S, the rc script executes this script with the word start after it.Thus, the rc script is actually executing this command to start the HTTP service:

/etc/rc.d/init.d/httpd start

SYMBOLIC LINKS = pointers to files

Kennesaw State University

Powerful and flexible way to stop and start system services:

For example, suppose you had reconfigured all of the networking information on a Linux system. Rather than restart the entire OS, simply execute these two commands to reinitialize networking:

/etc/rc.d/init.d/network stop

/etc/rc.d/init.d/network start

Some systems support the use of a single command:

/etc/rc.d/init.d/network restart

Kennesaw State University

[email protected] Lmux systems provide various GUI utilities to manage which services are started using this runlevel directory system. One example is the ksysv program for KDE.

The name ksysv may seem odd. The initial k simply means that the program is designed to run on the KDE Desktop. The reason for the sysv designation is historical. The initialization system just described for Linux is the same basic system that has been used for a long time in UNIX System V (a major version of the UNIX operating system). That system was adopted for Linux, and experienced system administrators know it as a standard System V (pronounced "system-five") initialization process-thus the name ksysv, for a KDE utility used to configure system 5-style initialization.

The LinuxConf utility in Red Hat Linux also provides a capability similar to ksysv.

Kennesaw State University

The initialization scripts located in /etc/re.d/init.d are provided for you when you install Linux.

In addition, if you install a new software package using the rpm command, a script will be placed in the correct directory if the package you install requires one to start a service.

Relatively few software packages are used for system services such as a Web server or e-mail server.

The initialization scripts in /etc/rc.d/init.d usually rely on a set of configuration information located in the /etc/sysconfig directory (and its subdirectories). Each file in /etc/sysconfig is named for a service, and each file contains name-value pairs that define for the initialization script how the service should be configured.