How do you validate a calendar expression and test a timer without waiting?
IntermediateConceptcron and systemd timers
Answer
systemd-analyze calendar 'Mon..Fri *-*-* 09:00:00' # normalized form and next elapse
systemd-analyze calendar --iterations=5 '*:0/15'
systemd-analyze verify /etc/systemd/system/backup.{service,timer}
systemctl start backup.service # run now
journalctl -u backup.service -n 50 --no-pager # see output
systemctl list-timers --all
systemd-analyze calendar catches typos like *-*-* 2:30 vs 02:30 interpretation, and shows the timezone used.
More on cron and systemd timers
Explain the five cron time fields with examples.BeginnerWhat is different about the environment a cron job runs in?BeginnerWhat is the difference between a user crontab, `/etc/crontab`, `/etc/cron.d/` and `/etc/cron.daily/`?IntermediateHow do you prevent overlapping cron runs and capture output properly?IntermediateWhat is a systemd timer and how does it compare to cron?IntermediateWrite a minimal systemd service and timer that run a backup at 02:30 daily.Intermediate