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

Re: [Sheflug] rc.d scripts




Ah, the murky world of UNIX initialisation...

I take it you mean the SysV style rc.d directory? The one with
the rc?.d subdirectories? BSD have (or did have) a different style
which worked slightly differently.

Basically, when 'init' starts it looks in /etc/inittab to see what
runlevel it should start at (initdefault) and what to do to initialise
the runlevel. On my redhat system, theres a command like
/etc/rc.d/rc 'runlevel'. /etc/rc.d/rc is a script that goes into the
/etc/rc.d/rc'runlevel'.d subdirectory and executes all the scripts
whose name begins with an 'S' (for start) in alphabetical order.

So, on my system, initdefault is set to 5. The initialisation line
is '/etc/rc.d/rc 5'. So when the system boots, all the scripts in
/etc/rc.d/rc5.d/S* get executed, in alphabetical order. You'll notice
a naming convention to these scripts - S followed by a two digit number
followed by a name (e.g. S05apmd). Lower numbered scripts get run 
before higer numbered ones, with the name giving some indication as to
what the script is supposed to do.

Most of the scripts in the rc'x'.d subdirectories are symlinks to
actual physical scripts in some other directories (on my redhat
system that /etc/rc.d/init.d). This saves replication of scripts
to bring services up in different runlevels.

When the shutdown command is executed, it basically tells init
to change its runlevel (to either 0 or 6, /etc/inittab should
say what each runlevel does). To change from runlevel 'a' to
runlevel 'b', go into /etc/rc.d/rc'a'.d and run all the 'K'
scripts (again in alphabetical order) and then go into 
/etc/rc.d/rc'b'.d and run all the 'S' scripts.

The scripts themselves usually rely on lots of system information
which is secreted away in various distribution dependant places.

A.D.



On Fri, Jun 02, 2000 at 11:35:33AM +0100, Steve Tickle wrote:
> Could someone possibly direct me to a resource where I can bone up on the 
> shadowy world of rc.d scripts? As a relative newbie I have absolutely no 
> understanding of the structure and modus operandi of this directory and 
> its' children. I've had a scan around www.linuxdoc.org but haven't spotted 
> anything which might be of relevance.
> 
> Cheers
> 
> Steve
> 
> 
> ---------------------------------------------------------------------
> Sheffield Linux User's Group - http://www.sheflug.co.uk
> To unsubscribe from this list send mail to
> - <sheflug-request [at] vuw.ac.nz> - with the word 
>  "unsubscribe" in the body of the message. 
> 
>   GNU the choice of a complete generation.
> 
> 
---------------------------------------------------------------------
Sheffield Linux User's Group - http://www.sheflug.co.uk
To unsubscribe from this list send mail to
- <sheflug-request [at] vuw.ac.nz> - with the word 
 "unsubscribe" in the body of the message. 

  GNU the choice of a complete generation.