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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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. |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
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 |