13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

20.5 Things That Make It Go457Example 20.3 A directory of scripts[mschwarz@host238 mschwarz]$ cd /etc/rc5.d[mschwarz@host238 rc5.d]$ lsK01yum K73ypbind S18rpcgssd S58ntpdK05saslauthd K74nscd S19rpcidmapd S80sendmailK11jboss K89netplugd S19rpcsvcgssd S80spamassassinK12mysqld S00microcode_ctl S20random S85gpmK15httpd S04readahead_early S24pcmcia S90cr<strong>on</strong>dK15postgresql S05kudzu S25netfs S90vmwareK20nfs S06cpuspeed S26apmd S90xfsK24irda S08iptables S28autofs S95anacr<strong>on</strong>K35smb S09isdn S40smartd S95atdK35vncserver S10network S44acpid S96readaheadK35winbind S12syslog S55cups S97messagebusK36lisa S13irqbalance S55sshd S97rhnsdK50snmpd S13portmap S56rawdevices S99localK50snmptrapd S14nfslock S56xinetdNotice the file S95atd? Let’s look at the l<strong>on</strong>g form ls output for that file:[mschwarz@host238 rc5.d]$ ls -la S95atdlrwxrwxrwx 1 root root 13 Feb 2 02:08 S95atd -> ../init.d/atdThe file is a symbolic link to the file in the init.d directory! If you takea look at the actual script run by the /etc/inittab file <strong>on</strong> 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, runthrough them in numerical order, and execute the linked scripts with stop asthe argument. It then picks up all the files that begin with S, runs through themin 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 thestarting and stopping of services by runlevel. Adding or removing a new serviceis simply a matter of creating the /etc/init.d script, and then adding the12. That phrase actually caused my high school grammar teacher to materialize in my officeand scold me. I invite any<strong>on</strong>e who can come up with an elegant and grammatical way to phrasethat to c<strong>on</strong>tact me at mschwarz@multitool.net. I’m perfectly serious.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!