[systemd-devel] Understanding the effect of AccuracySec=

Windl, Ulrich u.windl at ukr.de
Fri Aug 16 09:43:55 UTC 2024


Hi!

I have defined a time using

[Timer]
OnCalendar=daily
AccuracySec=6h
Persistent=true

And the idea was to run the unit daily, but it's rather unimportant when, just nout in prime hours.

The man page says:

       AccuracySec=
           Specify the accuracy the timer shall elapse with. Defaults to 1min.
           The timer is scheduled to elapse within a time window starting with
           the time specified in OnCalendar=, OnActiveSec=, OnBootSec=,
           OnStartupSec=, OnUnitActiveSec= or OnUnitInactiveSec= and ending
           the time configured with AccuracySec= later. Within this time
           window, the expiry time will be placed at a host-specific,
           randomized but stable position that is synchronized between all
           local timer units. This is done in order to distribute the wake-up
           time in networked installations, as well as optimizing power
           consumption to suppress unnecessary CPU wake-ups. To get best
           accuracy, set this option to 1us. Note that the timer is still
           subject to the timer slack configured via systemd-system.conf(5)'s
           TimerSlackNSec= setting. See prctl(2) for details. To optimize
           power consumption, make sure to set this value as high as possible
           and as low as necessary.

So I expected that multiple instances of the timer would be "spread", but instead I see all instances started at 00:00:01.
So did I misunderstand, or is it some kind of bug with timer instances? Systemd being used is old systemd-228-157.60.1.x86_64 in SLES 12 SP5...

Or is

[Install]
WantedBy=timers.target

Causing this?


Kind regards,
Ulrich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240816/0a691916/attachment.htm>


More information about the systemd-devel mailing list