[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#401053: apache2: force-reload doesn't take 'runlevels' into account



Peter Samuelson wrote:
[Olaf van der Spek]
But where does it check whether the service is supposed to run in the
current runlevel? I didn't see that check in the script itself.

It doesn't.  No init script does.  That is the job of invoke-rc.d.

invoke-rc.d decides whether to run the script or not, based on the
current runlevel.  invoke-rc.d always runs a script for 'reload' or
'force-reload' even if the runlevel doesn't include the service, but
the same is _not_ true for 'start' or 'restart'.

What's the reason for this distinction?

Policy says that 'restart' is supposed to start a service if it is not
already running, and arguably the same is allowed for 'force-reload'.
But in practice, as you saw with this bug, that can cause problems, so

If runlevels were respected a big part of the problem would already be solved.

aliasing 'force-reload' to 'reload' (which does not do this, in the
apache script) is not only the Right Thing to do in a theoretical
sense, it also happens to fix your bug.

Put another way: the real bug is the expectation elsewhere that
'invoke-rc.d foo force-reload' will not start a service in the wrong
runlevel.  Lots of packages violate this assumption, and Policy seems
to allow it.  apache2 just happens to have support for 'reload' so it
can easily be modified to avoid that issue.




Reply to: