Re: Files in the /rtc/rc.d/rc*.d directory
From: Bill Unruh (unruh_at_string.physics.ubc.ca)
Date: 02/22/05
- Next message: Rich Gibbs: "Re: Files in the /rtc/rc.d/rc*.d directory"
- Previous message: Charles Fox: "What's a good cheap webcam for Fedora FC3?"
- In reply to: Laurenz Albe: "Re: Files in the /rtc/rc.d/rc*.d directory"
- Next in thread: Laurenz Albe: "Re: Files in the /rtc/rc.d/rc*.d directory"
- Reply: Laurenz Albe: "Re: Files in the /rtc/rc.d/rc*.d directory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 22 Feb 2005 17:08:40 GMT
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.
- Next message: Rich Gibbs: "Re: Files in the /rtc/rc.d/rc*.d directory"
- Previous message: Charles Fox: "What's a good cheap webcam for Fedora FC3?"
- In reply to: Laurenz Albe: "Re: Files in the /rtc/rc.d/rc*.d directory"
- Next in thread: Laurenz Albe: "Re: Files in the /rtc/rc.d/rc*.d directory"
- Reply: Laurenz Albe: "Re: Files in the /rtc/rc.d/rc*.d directory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|