Bluehost.com Web Hosting $6.95

Files in the /rtc/rc.d/rc*.d directory

This is a discussion on Files in the /rtc/rc.d/rc*.d directory within the Linux General forums, part of the Linux Forums category; What are the files in the /rtc/rc.d/rc*.d directories ? All the files are links to scripts located ...


Go Back   Usenet Forums > Linux Forums > Linux General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-22-2005
Dani Camps
 
Posts: n/a
Default Files in the /rtc/rc.d/rc*.d directory

What are the files in the /rtc/rc.d/rc*.d directories ? All the files
are links to scripts located in /etc/rc.d/init.d, so are these the
scripts that are called when the system boots in each of the possible
runlevels ? And when the systems shuts down are the scripts in this
directory called as well ? Why there are some links starting with K
and another ones with S, are ones called during the boot and the
others during the shutdown ? Which ones when in that case ? And what
about the digital code after the letter S or K, what does it mean ?

Thanks
Reply With Quote
  #2 (permalink)  
Old 02-22-2005
Laurenz Albe
 
Posts: n/a
Default Re: Files in the /rtc/rc.d/rc*.d directory

Dani Camps <danicamps81@gmail.com> wrote:
> What are the files in the /rtc/rc.d/rc*.d directories ? All the files
> are links to scripts located in /etc/rc.d/init.d, so are these the
> scripts that are called when the system boots in each of the possible
> runlevels ? And when the systems shuts down are the scripts in this
> directory called as well ? Why there are some links starting with K
> and another ones with S, are ones called during the boot and the
> others during the shutdown ? Which ones when in that case ? And what
> about the digital code after the letter S or K, what does it mean ?


You can get much more information than what I am going to give you
with a web search for "System V" initialization.

Like the good article on http://www.freeos.com/articles/3243/

Most of what you guess is correct.
The S* scripts ate called when you enter that runlevel, and the
K* scripts are called when you leave the runlevel (Start and Kill).
The number after the S or K defines a sequence in which the startup
or shutdown scripts are called: e.g. you want the network up before
you start NFS.
When you boot the machine, you enter the runlevel specified by the
initdefault entry in /etc/inittab.
When you shutdown the computer, you go to runlevel 0.

There are various menu- and GUI-driven tools that facilitate maintaining
the symbolic links in the /etc/rc.d directories.

Yours,
Laurenz Albe
Reply With Quote
  #3 (permalink)  
Old 02-22-2005
Bill Marcum
 
Posts: n/a
Default Re: Files in the /rtc/rc.d/rc*.d directory

On 22 Feb 2005 07:04:17 -0800, Dani Camps
<danicamps81@gmail.com> wrote:
> What are the files in the /rtc/rc.d/rc*.d directories ? All the files
> are links to scripts located in /etc/rc.d/init.d, so are these the
> scripts that are called when the system boots in each of the possible
> runlevels ? And when the systems shuts down are the scripts in this
> directory called as well ? Why there are some links starting with K
> and another ones with S, are ones called during the boot and the
> others during the shutdown ? Which ones when in that case ? And what
> about the digital code after the letter S or K, what does it mean ?
>


http://www.tldp.org/HOWTO/From-Power...mpt-HOWTO.html
Reply With Quote
  #4 (permalink)  
Old 02-22-2005
Bill Unruh
 
Posts: n/a
Default Re: Files in the /rtc/rc.d/rc*.d directory

danicamps81@gmail.com (Dani Camps) writes:

>What are the files in the /rtc/rc.d/rc*.d directories ? All the files
>are links to scripts located in /etc/rc.d/init.d, so are these the
>scripts that are called when the system boots in each of the possible


Yes.

>runlevels ? And when the systems shuts down are the scripts in this
>directory called as well ? Why there are some links starting with K


No. the ones in rc6.d are called.

>and another ones with S, are ones called during the boot and the


K=kill, S=start

>others during the shutdown ? Which ones when in that case ? And what
>about the digital code after the letter S or K, what does it mean ?


The order. The codes are sorted and run in order of sort. Since sort for
two digit numbers is numerical order, they are run in numerical order.


Reply With Quote
  #5 (permalink)  
Old 02-22-2005
Bill Unruh
 
Posts: n/a
Default Re: Files in the /rtc/rc.d/rc*.d directory

Laurenz Albe <albe@culturallNOSPAM.com> writes:

>Dani Camps <danicamps81@gmail.com> wrote:
>> What are the files in the /rtc/rc.d/rc*.d directories ? All the files
>> are links to scripts located in /etc/rc.d/init.d, so are these the
>> scripts that are called when the system boots in each of the possible
>> runlevels ? And when the systems shuts down are the scripts in this
>> directory called as well ? Why there are some links starting with K
>> and another ones with S, are ones called during the boot and the
>> others during the shutdown ? Which ones when in that case ? And what
>> about the digital code after the letter S or K, what does it mean ?


>You can get much more information than what I am going to give you
>with a web search for "System V" initialization.


>Like the good article on http://www.freeos.com/articles/3243/


>Most of what you guess is correct.
>The S* scripts ate called when you enter that runlevel, and the
>K* scripts are called when you leave the runlevel (Start and Kill).


No, both the K and S scripts are called when you enter. When you leave you
are in runlevel 6.
See /etc/rc.d/rc

*****************************
# Get first argument. Set new runlevel to this argument.
[ -n "$argv1" ] && runlevel="$argv1"

# Is there an rc directory for this new runlevel?
[ -d /etc/rc$runlevel.d ] || exit 0

# First, run the KILL scripts.
for i in /etc/rc$runlevel.d/K* ; do
check_runlevel "$i" || continue

# Check if the subsystem is already up.
subsys=${i#/etc/rc$runlevel.d/K??}
rc_splash $subsys
[ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \
|| continue

# Bring the subsystem down.
if egrep -q "(killproc |action )" $i ; then
$i stop
else
action "Stopping %s: " $subsys $i stop
fi
done

# Now run the START scripts.
for i in /etc/rc$runlevel.d/S* ; do
check_runlevel "$i" || continue

# Check if the subsystem is already up.
subsys=${i#/etc/rc$runlevel.d/S??}
[ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \
&& continue

# If we're in confirmation mode, get user confirmation
if [ -f /var/run/confirm ]; then
if [ "$subsys" = dm ]; then
CONFIRM_DM=1
continue
fi
confirm $subsys
case $? in
1) continue;;
2) rm -f /var/run/confirm;;
esac
fi

rc_splash $subsys

# Bring the subsystem up.
if [ "$subsys" = "halt" -o "$subsys" = "reboot" ]; then
export LC_ALL=C
exec $i start
fi

if [ "$subsys" = "single" ]; then
rc_splash stop
fi
if egrep -q "(daemon |action |success |failure )" $i 2>/dev/null \
|| [ "$subsys" = "single" -o "$subsys" = "local" ]; then
$i start
else
action "Starting %s: " $subsys $i start
fi

done

************************************************** ****************

So on entry to a runlevel, first the K scripts are run to kill of anything
that should not be run at that runlevel. Then the S scripts are run to
start up anything that should be started up at that runlevel




>The number after the S or K defines a sequence in which the startup
>or shutdown scripts are called: e.g. you want the network up before
>you start NFS.
>When you boot the machine, you enter the runlevel specified by the
>initdefault entry in /etc/inittab.
>When you shutdown the computer, you go to runlevel 0.

No 6

>There are various menu- and GUI-driven tools that facilitate maintaining
>the symbolic links in the /etc/rc.d directories.


Reply With Quote
  #6 (permalink)  
Old 02-22-2005
Rich Gibbs
 
Posts: n/a
Default Re: Files in the /rtc/rc.d/rc*.d directory

Dani Camps said the following, on 02/22/05 10:04:
> What are the files in the /rtc/rc.d/rc*.d directories ? All the files
> are links to scripts located in /etc/rc.d/init.d, so are these the
> scripts that are called when the system boots in each of the possible
> runlevels ? And when the systems shuts down are the scripts in this
> directory called as well ? Why there are some links starting with K
> and another ones with S, are ones called during the boot and the
> others during the shutdown ? Which ones when in that case ? And what
> about the digital code after the letter S or K, what does it mean ?
>



Red Hat has a good description of these files and how they fit into the
boot process in their Linux _Reference Guide_, which is available on
their Web site. The section relevant to your question is:

<http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/s1-boot-init-shutdown-process.html>

(Sorry about the length of the URL.)


--
Rich Gibbs
rgibbs@alumni.princeton.edu
Reply With Quote
  #7 (permalink)  
Old 02-23-2005
Laurenz Albe
 
Posts: n/a
Default Re: Files in the /rtc/rc.d/rc*.d directory

Bill Unruh <unruh@string.physics.ubc.ca> wrote:
>>The S* scripts ate called when you enter that runlevel, and the
>>K* scripts are called when you leave the runlevel (Start and Kill).

>
> No, both the K and S scripts are called when you enter. When you leave you
> are in runlevel 6.


Sorry, and thanks for the correction.

Yours,
Laurenz Albe
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:38 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0