On Thu, 2020-01-02 at 11:18 -0600, Richard Shaw wrote:
> On Thu, Jan 2, 2020 at 10:14 AM Zbigniew Jędrzejewski-Szmek <
> [email protected]> wrote:
>
> > On Thu, Jan 02, 2020 at 10:45:07AM -0500, Neal Gompa wrote:
> > > On Thu, Jan 2, 2020 at 10:11 AM Ben Cotton <[email protected]> wrote:
> > > Even with this proposal, how do we deal with system upgrades? In the
> > > system upgrade case, we don't really want these restarts to run,
> > > because the system will be rebooted anyway... These kinds of questions
> > > are why I didn't propose porting over what we did in OpenMandriva to
> > > Fedora. It's rather wasteful in a rather common case...
> >
> > I'm not sure if skipping restarts on upgrade is worth the trouble. It
> > should be quite simple to implement (e.g. by having the restart scriptlet
> > check if the systemd target has been diverted to system-update.target),
> > but restarting of services would most likely take only a small fraction
> > of time required for the upgrade anyway.
> >
>
> Maybe it should only restart the service if it's already running. In the
> case of an upgrade it's a special target, right?
>
> Actually that's probably a good idea anyway. If I have stopped a service
> (even if it's enabled) then it should not be restarted on upgrade.
This is exactly what 'try-restart' does: it restarts the service only
if it's running. Per the docs:
try-restart PATTERN...
Stop and then start one or more units specified on the command line
if the units are running. This does
nothing if units are not running.
The current %systemd_postun_with_restart scriptlet uses try-restart:
[adamw@adam koji ((koji-1.19.1))]$ rpm --eval "%systemd_postun_with_restart foo"
if [ $1 -ge 1 ] && [ -x /usr/bin/systemctl ] ; then
# Package upgrade, not uninstall
/usr/bin/systemctl try-restart foo || :
fi
The Change page doesn't *specifically* state what scriptlets
it's intended to replace, but I'd assume it would be that one. Thus I'd
expect that this mechanism would also use try-restart.
--
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Twitter: AdamW_Fedora | XMPP: adamw AT happyassassin . net
http://www.happyassassin.net
_______________________________________________
devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/[email protected]