S## and K##
Lennart Sorensen
lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Fri Nov 4 17:58:47 UTC 2011
On Fri, Nov 04, 2011 at 01:54:19PM -0400, William Park wrote:
> That means, it has to know previous runlevel. I was under the
> impression that K## runs on exit.
No, S and K run when you enter a runlevel.
It is the admin's job to take care of making transitions work. Init does
know what runlevel it came from of course, but that really doesn't make
any difference in what happens when you change runlevels. insserv and
other modern dependancy based init systems do keep track of what was
started already so they don't have to do it again in the new runlevel
that asks for the same services. Even the old sysvinit seemd capable
of doing that too at least in some implementations. I haven't looked
into how it does it, since it works.
After all if you want service foo running in runlevel 2 and 3, but not 4,
having a kill in 2 and 3 would mean leaving 2 to go to 3 would stop the
service, and then have to start it again. That's not practical so it
doesn't work that way.
Everything in a runlevel is what to do when going to that runlevel.
Note how runlevel 0 (shutdown) and 6 (reboot) has lots of K## scripts.
That's what stops things. There are very few K## scripts in any other
runlevel. Mostly S## scripts.
--
Len Sorensen
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list