#881166 log files, postrotate example: start-stop-daemon or invoke-rc.d?

#881166#5
Date:
2017-11-08 12:50:31 UTC
From:
To:
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

#881166#10
Date:
2017-11-08 19:54:34 UTC
From:
To:
Daniel Pocock <daniel@pocock.pro> writes:

There was a long discussion about this a while back, during which we
decided not to change this because of bad interations with policy-rc.d, I
think?  I'm not sure what the bug number was, though.

I agree that the behavior you're describing seems broken.

#881166#15
Date:
2017-11-08 19:54:34 UTC
From:
To:
Daniel Pocock <daniel@pocock.pro> writes:

There was a long discussion about this a while back, during which we
decided not to change this because of bad interations with policy-rc.d, I
think?  I'm not sure what the bug number was, though.

I agree that the behavior you're describing seems broken.