[systemd-devel] Ordering (apt) timer services to not run at the same time

Julian Andres Klode jak at debian.org
Sat Apr 29 20:37:55 UTC 2017


On Sat, Apr 29, 2017 at 11:40:44AM +0200, Lennart Poettering wrote:
> That said, there are limits to this: this will only work correctly if
> the start jobs for both units are either enqueued at the same time or
> in the order they are supposed to be run in. If however, the job for
> the unit that is supposed to be run second is enqueued first, it will
> be immediately dispatched (as at that moment ordering deps won't have
> any effect as the other unit isn't enqueue), and if the job for the
> first unit is then enqueued then both will run at the same time. This
> is simply as the queue dispatching order only matters at the moment a
> service is actually triggered, afterwards it doesn't matter anymore.
[...]
> So, I am not sure what i can recommend you, systemd's dependency
> currently cannot express what you want to do, but I sympathize with
> the problem. I am not entirely sure what a good and natural way would
> be though to extend systemd's logic for what you want to do.
> 
> Ideas?

This might sound crazy, but I think it might be sense to do one
of this:

(1) just wait regardless of the direction of the ordering relationship
- AKA: if the ordering is "broken" when queuing, reverse the order. Could
be a flag (NeverRunAtSameTime=yes).

(2) A weak ordering type like AfterIfActive=active.service

I'm not sure how this all works out with non-oneshot services,
but that's basically the optimal thing to do here.

-- 
Debian Developer - deb.li/jak | jak-linux.org - free software dev
                  |  Ubuntu Core Developer |
When replying, only quote what is necessary, and write each reply
directly below the part(s) it pertains to ('inline').  Thank you.


More information about the systemd-devel mailing list