< Day Day Up > |
You can manage the startup and shutdown of server daemons with special startup scripts located in the /etc/rc.d/init.d directory. These scripts often have the same name as the server's program. For example, for the /usr/sbin/httpd Web server program, the corresponding script is called /etc/rc.d/init.d/httpd. This script starts and stops the Web server. This method of using init.d startup scripts to start servers is called SysV Init, after the method used in Unix System V.
The startup scripts in the /etc/rc.d/init.d directory can be executed automatically whenever you boot your system. Be careful when accessing these scripts, however. These start essential programs, such as your network interface and your printer daemon. These init scripts are accessed from links in subdirectories set up for each possible runlevel. The /etc/rc.d directory holds a set of subdirectories whose names have the format rcN.d, where N is a number referring to a runlevel. The rc script detects the runlevel in which the system was started, and then executes only the startup scripts specified in the subdirectory for that runlevel. When you start your system, the rc script executes the startup scripts specified in the rc3.d directory, if you are performing a command line login, and the rc5.d directory, if you are using a graphical login. The rc3.d and rc5.d directories hold symbolic links to certain startup scripts in the /etc/rc.d/init.d directory. So, the httpd script in the /etc/rc.d/init.d directory is actually called through a symbolic link in the rc3.d or the rc5.d directory. The symbolic link for the /etc/rc.d/httpd script in the rc3.d directory is S85httpd. The S prefixing the link stands for "startup"; thus, the link calls the corresponding init.d script with the start option. The number indicates the order in which startup scripts are run; lower numbers run first. S85httpd invokes /etc/rc.d/init.d/httpd with the option start. If you change the name of the link to start with a K, the script is invoked with the stop option, stopping it. Such links are used in the runlevels 0 and 6 directories, rc6.d and rc0.d. Runlevel 0 halts the system and runlevel 6 reboots it. You can use the runlevel command to find out what runlevel you are currently operating at (see Chapter 27 for more details on runlevels). A listing of runlevels is shown in Table 20-2.
Runlevel |
rc.d Directory |
Description |
---|---|---|
0 |
rc0.d |
Halt (shut down) the system |
1 |
rc1.d |
Single-user mode (no networking, limited capabilities) |
2 |
rc2.d |
Multiuser mode with no NFS support (limited capabilities) |
3 |
rc3.d |
Multiuser mode (full operational mode) |
4 |
rc4.d |
User-defined, implemented by default on Red Hat the same as runlevel 3, multiuser mode |
5 |
rc5.d |
Multiuser mode with graphical login (full operation mode with graphical login added) |
6 |
rc6.d |
Reboot system |
< Day Day Up > |
This HTML Help has been published using the chm2web software. |