On 10/10/25 20:18, Jeremy Herbert wrote:
> Hi,
> 
> I am not sure if this is a bug or just me not understanding the behaviour
> correctly (the latter is more likely). Perhaps related to
> https://github.com/systemd/systemd/issues/6036
> 
> I have a system that doesn't have access to time or an RTC for about 10
> minutes after boot. When the system powers on, it starts at a system time
> of 2000-01-01 00:00:00 and then after ~10 minutes it will have the correct
> time. I have recently changed my cron jobs over to systemd timers, but it
> behaves differently in a time skip situation.
> 
> When systemd sees this time skip (forward 25+ years...) presumably it is
> trying to catch up, because it is running the job every 5 seconds pretty
> much constantly and it doesn't care about my OnCalendar= directive. Is
> there some directive or similar I can use to have the timer ignore time
> skips and only run if the OnCalendar directive matches the current time?

First, I recommend starting at a time that is better than 2000.
Starting with the current time right now would be a good choice.

Second, you should provide a service with a Before= dependency on
time-sync.target that waits until clock synchronization has
completed.  All timer units with OnCalendar= have an After=
dependency on time-sync.target and time-set.target. If you want
the timers to not run at all if clock sync fails, add Requires=
dependencies on these units, and give time-sync.target a Requires=
dependency on your service.

See man:systemd.special(7) for details.
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)

Attachment: OpenPGP_0xB288B55FFF9C22C1.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to