Init scripts
Much of the assortment of processes on a running UNIX system is
started by shell scripts invoked via /etc/inittab; there
are two major schemes for these scripts. All usually start with
some sort of global "rc" script.
BSD-style
- /etc/rc (or maybe /sbin/rc) invokes other
scripts like /etc/rc.net, /etc/rc.local; it gets
the desired run level as an argument which it uses to decide what to
start
- An /etc/rc.conf (or maybe /etc/rc.config file
provides configuration parameters used by other scripts
- Most local customization (to start up locally-installed
software) is done in /etc/rc.local
- /etc/rc.local can get pretty big and complicated
System V-style
- init invokes a global rc script passing the run level
as an argument, or maybe selects an rc script (rc1, rc2, rc3 ...)
based on run level
- /etc/init.d contains an assortment of scripts, each one of which
is concerned only with a particular subsystem; each takes standard
arguments like "start" or "stop" that tell it what to do with that subsystem
- /etc/rcN.d (one for each run level N) contains links to
/etc/init.d scripts which are run when run level N is selected
- There is a standard naming scheme for the /etc/rcN.d scripts to
sequence them properly; "S" or "K" says whether to run the script
with its "start" or "stop" argument, a two-digit sequence number
sorts them into order, and then a symbolic name follows to indicate
the subsystem involved, usually the same as used in the init.d
script
- The rc.d "K" scripts are run first, then "S" scripts
- This is much more complicated than the BSD system, but also much
more modular, and easier for automated installers to work with; as a
sysadmin, rather than editing and rearranging a global rc.local, you
instead create, edit, and rename individual init.d scripts and rc.d links
Next ->
Steve VanDevender
Last modified: Thu Jul 6 12:06:49 PDT 2006