Re: Fedora 32 System-Wide Change proposal: Restart services at end of rpm transaction

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

 



On Thu, Jan 02, 2020 at 09:39:38AM -0800, Adam Williamson wrote:
> 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 <
> > zbyszek@xxxxxxxxx> 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 <bcotton@xxxxxxxxxx> 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.

Yes, exactly. Thank you for the very nice summary.
More generally, the goal is to do the exact same restarts that are done
now, but at a different point in the transaction and from a different
call site.

Zbyszek
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
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/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux