Package: debian-policy
Version: 4.1.1.1

In the section on log files[1], the example uses start-stop-daemon:

postrotate
    start-stop-daemon -K -p /var/run/foo.pid -s HUP -x /usr/sbin/foo -q
endscript

while elsewhere in the policy manual it is suggested to use invoke-rc.d

Inspecting my own system, I noticed most logrotate scripts use
invoke-rc.d, not start-stop-daemon

Imagine the following scenario:

- a package distributes an init script that runs the process with a PID file

- later on, the package maintainer starts distributing a systemd unit
file as well, running the process in foreground without a PID file, but
the init script is still included in the package too

In this case, when the package is installed on a systemd system,
start-stop-daemon would never find a PID file and rotation doesn't work.

Some scripts also appear to make a check if invoke-rc.d really exists
and then fall back to "service foo reload":

        postrotate
                if which invoke-rc.d >/dev/null 2>&1; then
                        invoke-rc.d foo rotate > /dev/null
                else
                        if [ -f /var/run/foo.pid ]; then
                                /etc/init.d/foo rotate > /dev/null
                        fi
                fi
        endscript


Should the debian-policy example be changed to invoke-rc.d or to
something more elaborate?

Regards,

Daniel


1. https://www.debian.org/doc/debian-policy/#log-files

Reply via email to