Timers (.timer)

Spread scheduled jobs with RandomizedDelaySec (avoid the thundering herd)

3 min · updated June 15, 2026

If 500 servers all run OnCalendar=*-*-* 03:00:00, they hit your update mirror or API at 03:00:00 together. RandomizedDelaySec= scatters each run by a random amount so the load spreads out.

The timer

[Unit]
Description=Nightly pull, jittered

[Timer]
OnCalendar=*-*-* 03:00:00
RandomizedDelaySec=1h
Persistent=true

[Install]
WantedBy=timers.target

Accuracy (the other source of jitter)

systemd already batches timers within a window to save power — that’s AccuracySec=, which defaults to 1 minute. For deliberate spreading use RandomizedDelaySec=; if you instead need a job to fire precisely on time, tighten accuracy:

[Timer]
OnCalendar=*-*-* 03:00:00
AccuracySec=1s

Enable and see the real next run

sudo systemctl daemon-reload
sudo systemctl enable --now nightly.timer
systemctl list-timers nightly.timer    # NEXT shows the jittered time

When to use: cron-style fleet jobs (updates, backups, telemetry) pointed at a shared endpoint, or many timers on one box you don’t want firing on the same tick. Gotcha: RandomizedDelaySec= adds to the schedule (it never fires early), so set OnCalendar to the earliest acceptable time and let the jitter push later.

← All recipes