[NBLUG/talk] Debian init.d and runlevel question
E Frank Ball
frankb at frankb.us
Thu Jun 15 13:49:01 PDT 2006
On Thu, Jun 15, 2006 at 01:27:29PM -0700, Bob Blick wrote:
} Perhaps someone can clear up my confusion regarding scripts in /etc/init.d
} and symlinks to them in /etc/rcX.d - I'm new to Debian in this regard.
} My understanding has always been that if you have a script "foo" in
} /etc/init.d, and a symlink to it in /etc/rc2.d named S40foo, it will be
} run after the S39's when runlevel 2 has been started. If it was named
} K40foo, it would be run when runlevel 2 was exited.
} But the README inside rc2.d says:
} To disable a service in this runlevel, rename its script in this directory
} so that the new name begins with a 'K' and a two-digit number, where the
} number is the difference between the two-digit number following the 'S'
} in its current name, and 100. To re-enable the service, rename the script
} back to its original name beginning with 'S'.
} That confuses me - If I rename it with a "K", isn't the linked script
} going to be run when I exit the runlevel?
The "S" scripts in /etc/rc2.d/ are run with the argument "start".
The "K" scripts in /etc/rc2.d/ are run with the argument "stop".
example: S40foo would run "/etc/init.d/foo start"
K40foo would run "/etc/init.d/foo stop".
I usually just delete the symbolic link if I don't want it.
If you are not switching between different run levels the
"K" usually isn't needed.
With Redhat/Fedora run level 3 is console and 5 is X, so I
sometimes switch between 5 and 3. Any K scripts will run at
this time to kill off X and other unwanted things.
E Frank Ball frankb at frankb.us
More information about the talk