Section 3.2:Behind the Scenes of the Boot Process
When init starts, it becomes the parent or grandparent of all of the processes that start up automati-
cally on your Red Hat Linux system. First, it runs the /etc/rc.d/rc.sysinit script, which sets
your path, starts swapping, checks the filesystems, and so on. Basically, rc.sysinit takes care of
everything that your system needs to have done at system initialization. Most systems use a clock, so
on them rc.sysinit uses the /etc/sysconfig/clock file to initialize the clock. If you have
special serial port processes that need to be initialized, rc.sysinit may also run rc.serial.
Then, init runs the /etc/inittab script, which describes how the system should be set up in
each runlevel and sets the default runlevel. (See Section 3.4, Init Runlevels for more information on
init runlevels.) This file states, among other things, that /sbin/update should be run whenever a
runlevel starts. The update program is used to flush dirty buffers back to disk.
Whenever the runlevel changes, init uses the scripts in /etc/rc.d/init.d to start and stop
various services, such as your web server, DNS server, and so on. First, init sets the source function
library for the system (commonly /etc/rc.d/init.d/functions), which spells out how to
start or kill a program and how to find out the PID of a program. Then, init determines the current
and the previous runlevel.
Next, init starts all of the background processes necessary for the system to run by looking in the
appropriate rc directory for that runlevel (/etc/rc.d/rc <x> .d, where the < x > is numbered
0-6). init runs each of the kill scripts (their file name starts with a K) with a stop parameter.
Then, init runs all of the start scripts (their file names start with an S) in the appropriate run-
level directory with a start so that all services and applications are started correctly. In fact, you
can execute these same scripts manually after the system is finished booting with a command like
/etc/rc.d/init.d/httpd stop or service httpd stop logged in as root. This will
stop the httpd server.
When starting services manually, you should be root. If you get a error when
executing service httpd stop, you may not have /sbin pathed in
/root/.bashrc (or the correct .rc file for your preferred shell). You
can either type the full command of /sbin/service httpd stop or
add export PATH="$PATH:/sbin" to your shell .rc file. If you edit
your shell configuration file, log out and back in as root to make the changed
shell configuration file take effect.
None of the scripts that actually start and stop the services are located in /etc/rc.d/rc <x> .d.
Rather, all of the files in /etc/rc.d/rc <x> .d are symbolic links that point to actual scripts lo-
cated in /etc/rc.d/init.d. A symbolic link is nothing more than a file that simply points to
another file, and they are used in this case because they can be created and deleted without affecting
the actual script that kills or starts the service. The symbolic links to the various scripts are numbered
Note
39
Need help?
Do you have a question about the LINUX 7.2 and is the answer not in the manual?
Questions and answers