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: systemd-analyze calendar checks an OnCalendar expression before you rely on it

Systemd
~/tips/tip-systemd-analyze-calendar-expression

systemd-analyze calendar "Mon..Fri *-*-* 03:30" --iterations=3

Shows the normalised form and the next run times of a timer schedule expression.

Calendar syntax is compact and I do not trust my reading of it, so I let systemd say when it will fire.

systemd-analyze calendar "Mon..Fri *-*-* 03:30" --iterations=3

The command prints the normalised form of the expression, the next elapse time in your timezone and how far away it is. --iterations=3 shows the next three runs. Invalid input gives an error, so it also catches typos. Use the same string in OnCalendar= of your timer unit. Without a timezone, the local zone is assumed, which on a UTC server differs from your wall clock.

Further reading: systemd.time 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