RC SCRIPTS
1.
The /etc/inittab
file specifies which scripts to run when runlevels change.
2.
These scripts are
responsible for either starting or stopping the services that are particular to
the runlevel.
3.
Because of the
number of services that need to be managed, rc scripts are used.
4.
The main one, /etc/rc.d/rc,
is responsible for calling the appropriate scripts in the correct order for
each runlevel.
5.
Such a script
could easily become extremely uncontrollable to keep this from happening, a
slightly more elaborate system is used.
6.
For each
runlevel, a subdirectory exists in the /etc/rc.d directory.
7.
These runlevel
subdirectories follow the naming scheme of rc X .d, where X is
the runlevel. For example, all the scripts for runlevel 3 are in /etc/rc.d/rc3.d.
8.
In the runlevel
directories, symbolic links are made to scripts in the /etc/rc.d/init.d directory.
9.
Instead of using
the name of the script as it exists in the /etc/rc.d/init.d directory,
however, the symbolic links are prefixed with an S, if the script is to
start a service, or with a K, if the script is to stop (or kill) a
service.
10. These two letters are casesensitive.
You must use uppercase letters, or the startup scripts will not recognize them.
11. In many cases, the order in which
these scripts are run makes a difference. For example, you can’t start services
that rely on a configured network interface without first enabling and
configuring the network interface.
12. To enforce order, a two-digit number
is suffixed to the S or K. Lower numbers execute before higher
numbers; for example, /etc/rc.d/rc3.d/ S10network runs before /etc/rc.d/rc3.d/S55sshd
(S10network configures the network settings, and S55sshd starts
the Secure Shell [SSH] server).
13. The scripts pointed to in the /etc/rc.d/init.d
directory are the workhorses i.e. they perform the actual process of
starting and stopping services.
14. When /etc/rc.d/rc runs through
a specific runlevel’s directory, it invokes each script in numerical order.
No comments:
Post a Comment