[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reboot, autoload server





--- Adam Williams <awilliam@whitemice.org> wrote:
> On Oct 1, 12:15am, Mike Nicholas wrote:
> > Subject: Reboot, autoload server
> > Is there a procedure (when a server reboots as in power
> interruption) to
> > have it automatically load, login as root, and run a server
> program to allow
> > users to then again access it?  RH 5.x
> 
> Yes,  each server usually has a script in /etc/rc.d/init.d/.  There
> are
> runcontrol directories for each runlevel (say /etc/rc.d/rc3.d for
> runlevel 3)
> that contains symlinks to scripts in /etc/rc.d/init.d for each
> service you want
> to start in the given runlevel.
> 
> 
As an additional note, the symlinks are used for 'starting' (lead
with an S##) and 'killing' (start with K##) for various run-levels. 
Depending on the installation, you will usually see rc0.d through
rc6.d.  
rc0.d and rc6.d are 'shutdown' runlevels and should be filled with
mostly 'K##' links.
rc1.d is 'single user' mode which is handy for doing administration
work as it can be configured to shut down the multi-user modes and
any services associated with such.
rc3.d, rc4.d and rc5.d are usually found to be the default (one or
the other) on most distributions.  Usually having one of them
reserved for starting a console session and one for doing an X
session.

in addition to being linked as 'start' (S##) and kill (K##), they
also have two numbers on the end that determine the order in which
they are run.  Kill scripts are run first in order (presumably
following ascii-betical / directory read order) from K00 to K99.  The
same then holds true for the S00 to S99 prefixed scripts which run
next.

It is possible, since the S/K prefixed scripts are suffixed with the
init.d script name, to include more than one to start at the same
digit - however, it is wise to learn the concepts behind the existing
order.  I am not sure if there is a 'master key' somewhere as to what
is recommended to have killed/started at 00 to 99, however, you will
usually find it wise to have the K## value be equal to the S## - 99. 
(e.g. something that starts at S00 would wise to kill at K99 and vice
versa - that which starts first should end last and that which starts
last should end first)

the /etc/rc.d/init.d scripts are just basic 'wrappers' used by the
init mechanisms.  The prefix is checked to see whether it is a start
or a stop and usually the init scripts are then going to send a
command line parameter of 'start' or 'stop' accordingly.
I usually use the /etc/rc.d/init.d/sendmail script as a sample when
building other start-up scripts as it is usually one of the more
thorough one's (including start, stop, status, etc).

Scott



=====

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com