Java Reference
In-Depth Information
controls. Let's take a very brief look at
/etc/inittab
and how it works; then
we'll move on to the extended scripts that manage server processes. That is
where we will integrate JBoss.
A key concept in the System V init system is the
runlevel
. The idea is that
a system can have a number of “standard” configurations, numbered from 0 to
6, where 0 is shutdown, 1 is single-user, 2 to 5 are up to the system administra-
tor, and 6 is reboot. The
init
9
command can be used (by the
root
user) to
change the system from its current runlevel to another:
# init 1
What 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
file
from a Fedora Core 1
10
system (Example 20.1).
This is a pretty complex file, and we don't want to bog down in it too
much, since most of what interests us occurs outside this file.
The basic format of a line in
/etc/inittab
is:
id:runlevels:action:process
The
id
is a unique 1-4 character identifier. The
runlevels
is a list of the
runlevel numbers to which the record applies. The
action
specifies what action
is to be taken. The
process
is the program to run. The
respawn
action, for
example, tells
init
that when the process exits, it should be run again. The
once
action says it should be run once on transition to the runlevel. We won't go
into too much more here. See the
man inittab
page for details.
The part that concerns us are the
l0
through
l6
entries. Note that these
cause the
/etc/rc.d/rc
script to be run once, with the runlevel passed as an
argument. This is the key to System V init system.
9.
telinit
is a common alias from other UNIX implementations. Linux symlinks this to
init
.
10. During the writing of this topic, RedHat decided to put their completely Free Software
OS out to a public-controlled project and to stop calling it “RedHat.” The name RedHat is
reserved for Fedora-based Linux systems that must be purchased with support contracts. It is
still the same system with a different name maintained by basically the same people. The key
difference is that you
cannot
purchase support for Fedora (at least from RedHat, we expect
some enterprising folks to offer Fedora support for a fee at some point).