Interview Prep/Shell Scripting/Scenarios: text processing and scheduling decisions

A job must run every 10 minutes, only on weekdays, between 09:00 and 18:00 IST, while servers run in UTC. Write the schedule.

BeginnerScenarioScenarios: text processing and scheduling decisions
Answer

Situation read → Express the time zone explicitly so it does not depend on the host setting.

What I'd do →

# systemd timer
[Timer]
OnCalendar=Mon..Fri *-*-* 09..17:00/10:00 Asia/Kolkata
# cronie (supports CRON_TZ)
CRON_TZ=Asia/Kolkata
*/10 9-17 * * 1-5 /opt/jobs/sync.sh
  1. 09..17 with every 10 minutes ends at 17:50; add 18:00 separately if the last run must be at 18:00.
  2. Verify: systemd-analyze calendar --iterations=5 'Mon..Fri *-*-* 09..17:00/10:00 Asia/Kolkata'.

Why → Explicit time zones remove ambiguity, and validating the expression avoids surprises.

Interview tip → Mention that Debian's Vixie cron ignores CRON_TZ, so test which cron you have.

All Shell Scripting questions Roadmap: Shell scripting (Bash)

More on Scenarios: text processing and scheduling decisions