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

Re: Restart rsyslog only once after few packages are upgraded



Am 26.10.22 um 11:49 schrieb Jędrzej Dudkiewicz:
I'm sorry if it was answered earlier, but I *really* couldn't find
anything about it.

I have few packages that are installed as part of a larger system on
Debian running on BeagleBone. These packages frequently (for some
strange reason - I'm not the only developer) modify files that go to
the /etc/rsyslog.d/ directory. These files are not part of
configuration, they are copied there by hand in postinstall script
from known source, reason being that which file is copied depends on
external configuration. This works without major problems. What is
problematic is that when these packages are upgraded, they are
upgraded few at a time, sometimes two are upgraded, sometimes four,
sometimes all of them. Because of this each package contains the
following:

systemctl restart rsyslog

in its postinstall script. As this causes rsyslog to be restarted a
few times in a row it sometimes results in rsyslog not functioning.

This shouldn't be a problem in theory.
That said, rsyslog could be part of the upgrade process, so maybe is in an inconsistent state when you trigger the restart. Would be interested to know more about the specific failures you encountered.

Thus, my question:

Is there a way to restart rsyslog only once, after all packages are
installed? I hope for something similar to "dh $@ --with-systemd" in
"rules" file (but "dh -l" does not show anything that looks like it
should work). My guess is that it should possible to somehow combine
"dh $@ --with-systemd" to achieve what I want, but I don't even know
where should I start.

The rsyslog package already offers a dpkg trigger which does
`invoke-rc.d rsyslog try-restart || true`

This trigger is activated by packages installing files into /etc/rsyslog.d

But you can activate that trigger explicitly as well via
dpkg-trigger --now-await rsyslog


So, if your package ships a file in /etc/rsyslog.d/ everything should work ootb. If you create the file dynamically via maintscripts, you need to add an explicit dpkg trigger in your maintscripts.

Michael

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


Reply to: