brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: RandomizedDelaySec spreads systemd timers so they do not all fire together

Systemd
~/tips/tip-systemd-timer-randomized-delay

[Timer]

Adds a random delay to each timer run, so many hosts do not hit a server at once.

Ten machines that all update at 03:00 sharp are hard on the mirror and on a shared uplink.

[Timer]
OnCalendar=*-*-* 03:00
RandomizedDelaySec=30min

RandomizedDelaySec= adds a random delay between zero and the given value to each trigger, picked anew every time. The apt daily timers on Debian and Ubuntu use it for the same reason. Remember that the job can start up to 30 minutes late, so do not use it for work that needs an exact time. Also note AccuracySec=, which defaults to one minute and lets systemd coalesce wakeups.

Further reading: systemd.timer manual page

More Systemd tips [Service] sudo mkdir -p /etc/systemd/system/service.d [Service] printf 'hunter2' | sudo systemd-creds encrypt --name=dbpass – dbpass.cred systemd-analyze timespan 1h30min All Systemd tips (88) All topics

Link