Controlling service start/stop/restart: policy-rc.d
All maintainer scripts in Debian
must use
the invoke-rc.d
command to start, stop or reload any daemons. One of the
advantages of this is that invoke-rc.d
can be controlled by local policy
so that daemons are never started inside chroots, or certain critical
services are not restarted by dpkg during package installation. The
local policy is provided by /usr/sbin/policy-rc.d
which is executed
by invoke-rc.d
and the exit code of policy-rc.d
determines whether
the service should be restarted or not. The local admin can bypass
the policy layer by running service(8)
or the init script manually.
The full details of how to set up a policy-rc.d
are documented
online
and also in the
sysv-rc package.
This script can be saved as /usr/sbin/policy-rc.d and will prevent
invoke-rc.d
calls that are made by dpkg
(i.e. during package installation
or upgrade) from doing anything.
Copyright for this policy-rc.d
Copyright © 2009-2012 Stuart Prescott stuart+debian@nanonanonano.net. The script and associated documentation are available under a 3-clause BSD-style licence.