How do you handle time zones in cron and systemd timers?
IntermediateConceptcron and systemd timers
Answer
Classic cron uses the system time zone (timedatectl); cronie supports CRON_TZ= per crontab. systemd OnCalendar= uses the system time zone unless you append one: OnCalendar=*-*-* 02:30:00 UTC or Asia/Kolkata.
Servers should run in UTC so logs, cron and incident timelines line up, and DST changes do not skip or double-run a 02:30 job. Express business-hour schedules explicitly with a time zone suffix.
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