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.

452Chapter 20Open Source Web <str<strong>on</strong>g>Applicati<strong>on</strong></str<strong>on</strong>g> Serversc<strong>on</strong>trols. Let’s take a very brief look at /etc/inittab and how it works; thenwe’ll move <strong>on</strong> to the extended scripts that manage server processes. That iswhere we will integrate JBoss.A key c<strong>on</strong>cept in the System V init system is the runlevel. The idea is thata system can have a number of “standard” c<strong>on</strong>figurati<strong>on</strong>s, numbered from 0 to6, where 0 is shutdown, 1 is single-user, 2 to 5 are up to the system administrator,and 6 is reboot. The init 9 command can be used (by the root user) tochange the system from its current runlevel to another:# init 1What happens when you issue such a command is determined by the/etc/inittab file. Let’s take a look at the out-of-the-box /etc/inittab filefrom a Fedora Core 1 10 system (Example 20.1).This is a pretty complex file, and we d<strong>on</strong>’t want to bog down in it toomuch, since most of what interests us occurs outside this file.The basic format of a line in /etc/inittab is:id:runlevels:acti<strong>on</strong>:processThe id is a unique 1–4 character identifier. The runlevels is a list of therunlevel numbers to which the record applies. The acti<strong>on</strong> specifies what acti<strong>on</strong>is to be taken. The process is the program to run. The respawn acti<strong>on</strong>, forexample, tells init that when the process exits, it should be run again. The <strong>on</strong>ceacti<strong>on</strong> says it should be run <strong>on</strong>ce <strong>on</strong> transiti<strong>on</strong> to the runlevel. We w<strong>on</strong>’t gointo too much more here. See the man inittab page for details.The part that c<strong>on</strong>cerns us are the l0 through l6 entries. Note that thesecause the /etc/rc.d/rc script to be run <strong>on</strong>ce, with the runlevel passed as anargument. This is the key to System V init system.9. telinit is a comm<strong>on</strong> alias from other UNIX implementati<strong>on</strong>s. <strong>Linux</strong> symlinks this to init.10. During the writing of this book, RedHat decided to put their completely Free SoftwareOS out to a public-c<strong>on</strong>trolled project and to stop calling it “RedHat.” The name RedHat isreserved for Fedora-based <strong>Linux</strong> systems that must be purchased with support c<strong>on</strong>tracts. It isstill the same system with a different name maintained by basically the same people. The keydifference is that you cannot purchase support for Fedora (at least from RedHat, we expectsome enterprising folks to offer Fedora support for a fee at some point).

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

Saved successfully!

Ooh no, something went wrong!