6 Chapter 1. Boot Process, Init, and ShutdownAs illustrated in this listing, none of the scripts that actually start and stop the services are located inthe /etc/rc.d/rc5.d/ directory. Rather, all of the files in /etc/rc.d/rc5.d/ are symbolic linkspointing to scripts located in the /etc/rc.d/init.d/ directory. Symbolic links are used in each ofthe rc directories so that the runlevels can be reconfigured by creating, modifying, and deleting thesymbolic links without affecting the actual scripts they reference.The name of each symbolic link begin with either a K or an S. The K links are processes that are killedon that runlevel, while those beginning with an S are started.The init command first stops all of the K symbolic links in the directory by issuing the/etc/rc.d/init.d/ command stop command, where command is the process to bekilled. It then starts all of the S symbolic links by issuing /etc/rc.d/init.d/ commandstart.TipAfter the system is finished booting, it is possible to log in as root and execute these same scriptsto start and stop services. For instance, the command /etc/rc.d/init.d/httpd stop stops theApache HTTP Server.Each of the symbolic links are numbered to dictate start order. The order in which the services arestarted or stopped can be altered by changing this number. The lower the number, the earlier it isstarted. Those symbolic links with the same number are started alphabetically.NoteOne of the last things the init program executes is the /etc/rc.d/rc.local file. This file is usefulfor system customization. Refer to Section 1.3 Running Additional Programs at Boot Time for moreinformation about using the rc.local file.After the init command has progressed through the appropriate rc directory for the runlevel, the/etc/inittab script forks an /sbin/mingetty process for each virtual console (login prompt)allocated to the runlevel. Runlevels 2 through 5 has all six virtual consoles, while runlevel 1 (singleuser mode) has one and runlevels 0 and 6 have none. The /sbin/mingetty process opens communi-cation pathways to tty devices5, sets their modes, prints the login prompt, accepts the user’s usernameand password and initiates the login process.In runlevel 5, the /etc/inittab runs a script called /etc/X11/prefdm. The prefdm script ex-ecutes the preferred X display manager6 — gdm, kdm, or xdm, depending on the contents of the/etc/sysconfig/desktop file.Once finished, the system is operating on runlevel 5 and displaying a login screen.1.3. Running Additional Programs at Boot TimeThe /etc/rc.d/rc.local script is executed by the init command at boot time or when changingrunlevels. Adding commands to the bottom of this script is an easy way to perform necessary taskslike starting special services or initialize devices without writing complex initialization scripts in the/etc/rc.d/init.d/ directory and creating symbolic links.5. Refer to Section 5.3.11 /proc/tty/ for more information about tty devices.6. Refer to Section 7.5.2 Runlevel 5 for more information about display managers.