Bruce Perens writes ("/etc/init.d/rc"):
> > Since the scripts when invoked as `start' should do nothing when
> > the service is already running, runlevel changes should not disturb
> > unaffected services.
> Many existing rc scripts will start additional copies of the same
> daemon when you change from one level to another.
These should be fixed. I've already reported a several such problems
as bugs, and the maintainers of changed their packages.
> To get the behavior
> you describe, every script would have to use start-stop-daemon or something
> to carefully check that a daemon isn't already running before attempting
> to start it. This is a complication that we should not have to require
> of each individual init script.
Firstly, I believe that that is *already* what we require.
Secondly, this is the whole reason why I wrote start-stop-daemon.
start-stop-daemon is very easy to use in most cases. IMO requiring
its use (or the use of something with similar functionality) is not at
The only way to do this job reliably is to check what the current
state of the system is before attempting to change it.
Furthermore, K scripts that don't use start-stop-daemon will probably
occasionally kill unwisely-named user programs (most of these use
hacks involving `ps' or `killall' which are not specific enough).
> > There may be good reasons for wanting to shut down and restart a
> > service on a runlevel change - perhaps another service needs to be
> > running first for it to find it, for example.
> The behavior I was going after was something a bit closer to the way
> /etc/inittab works for a service that exists in more than one runlevel.
It is possible to do things like
to get xdm shut down and respawned on runlevel change. The init.d
scripts are supposed to be *more* powerful, not less ...