Java Reference
In-Depth Information
Example 20.3 A directory of scripts
[mschwarz@host238 mschwarz]$ cd /etc/rc5.d
[mschwarz@host238 rc5.d]$ ls
K01yum K73ypbind S18rpcgssd S58ntpd
K05saslauthd K74nscd S19rpcidmapd S80sendmail
K11jboss K89netplugd S19rpcsvcgssd S80spamassassin
K12mysqld S00microcode_ctl S20random S85gpm
K15httpd S04readahead_early S24pcmcia S90crond
K15postgresql S05kudzu S25netfs S90vmware
K20nfs S06cpuspeed S26apmd S90xfs
K24irda S08iptables S28autofs S95anacron
K35smb S09isdn S40smartd S95atd
K35vncserver S10network S44acpid S96readahead
K35winbind S12syslog S55cups S97messagebus
K36lisa S13irqbalance S55sshd S97rhnsd
K50snmpd S13portmap S56rawdevices S99local
K50snmptrapd S14nfslock S56xinetd
Notice the file S95atd ? Let's look at the long form ls output for that file:
[mschwarz@host238 rc5.d]$ ls -la S95atd
lrwxrwxrwx 1 root root 13 Feb 2 02:08 S95atd -> ../init.d/atd
The file is a symbolic link to the file in the init.d directory! If you take
a look at the actual script run by the /etc/inittab file on a runlevel change,
you will notice that what it does is to pick up all the files in the rcX.d directory
(where X is the runlevel being changed to 12 ) that begin with the letter K , run
through them in numerical order, and execute the linked scripts with stop as
the argument. It then picks up all the files that begin with S , runs through them
in numerical order, and executes the linked scripts with start as the argument.
This sounds like a mess, but it is actually a very nice way to automate the
starting and stopping of services by runlevel. Adding or removing a new service
is simply a matter of creating the /etc/init.d script, and then adding the
12. That phrase actually caused my high school grammar teacher to materialize in my office
and scold me. I invite anyone who can come up with an elegant and grammatical way to phrase
that to contact me at mschwarz@multitool.net . I'm perfectly serious.
Search WWH ::




Custom Search