Back to all guides
Developer Tools8 min read

Crontab Syntax Explained: Mastering 5-Field Schedules, Interval Expressions, and Timezone Nuances

A complete developer guide to crontab syntax, asterisk wildcards, step intervals, day-of-week gotchas, and server scheduling architectures.

A
Aakash Sharma
Creator of Softnag & Full-Stack Developer
Published: August 22, 2026Updated: August 24, 2026
Crontab Syntax Explained: Mastering 5-Field Schedules, Interval Expressions, and Timezone Nuances - Developer Tools Illustrated Guide
Developer Tools

Developer Tools technical reference asset

Share this guide

From database backups and automated invoice billing to cache invalidation and nightly ETL data pipelines, the Unix cron daemon remains the backbone of asynchronous job scheduling. First developed by Ken Thompson for Version 7 Unix in 1979, cron syntax is universally utilized across Linux, Kubernetes CronJobs, AWS EventBridge, GitHub Actions, and Node.js schedule libraries.

While simple daily jobs are easy to configure, complex recurring cadences often trip up developers. Mastering cron syntax rules ensures critical tasks run exactly when intended without accidental over-execution.

The Anatomy of a 5-Field Cron Expression#

A standard POSIX crontab schedule consists of 5 whitespace-separated fields representing distinct temporal units:

┌───────────── Minute (0 - 59) │ ┌─────────── Hour (0 - 23) │ │ ┌───────── Day of Month (1 - 31) │ │ │ ┌─────── Month (1 - 12 or JAN - DEC) │ │ │ │ ┌───── Day of Week (0 - 6 or SUN - SAT) * * * * *

Special Characters: Asterisk (*), Comma (,), Hyphen (-), and Slash (/)#

• Asterisk (*): Wildcard matching every possible value in that position (e.g. * in the minute field means every minute).

• Comma (,): Delimits distinct discrete values (e.g. 15,45 in minutes means at 15 and 45 minutes past the hour).

• Hyphen (-): Specifies an inclusive continuous range (e.g. 1-5 in Day of Week means Monday through Friday).

• Slash (/): Defines step intervals (e.g. */10 in minutes means every 10 minutes; 20/5 in seconds means starting at 20 every 5 seconds).

The Day-of-Month vs Day-of-Week OR Relationship Gotcha#

One of the most frequent misconceptions in cron specification is setting both Day of Month and Day of Week simultaneously. In standard POSIX cron, if both fields are specified (i.e. neither is set to *), the job runs when EITHER the day-of-month matches OR the day-of-week matches (logical OR), rather than logical AND.

Common Bug Alert

To run a job only on the 1st of the month on a Monday, you must write conditional shell wrapper logic, as standard crontab will fire on all Mondays AND on the 1st of every month.

Timezones and Daylight Saving Time Traps#

Server cron daemons evaluate schedules against the host operating system’s local system clock. If a server is set to UTC, a job scheduled for "0 2 * * *" (2:00 AM) will execute at 9:00 PM EST.

Furthermore, in regions observing Daylight Saving Time (DST), clocks springing forward from 1:59 AM to 3:00 AM will skip jobs scheduled at 2:30 AM entirely, while clocks falling back will trigger the 2:30 AM job twice. For production stability, always configure server clocks in UTC.

Key Takeaways & Best Practices
  • Cron expressions follow a standard 5-part structure: Minute, Hour, Day of Month, Month, Day of Week.
  • Step intervals (/) make expressing periodic cadences (e.g. */15) concise and standardized.
  • Setting both Day of Month and Day of Week creates a logical OR condition in POSIX cron implementations.
  • Configure production servers in Coordinated Universal Time (UTC) to eliminate Daylight Saving Time execution skips.

Final Thoughts

Crontab expressions provide a universal, declarative language for scheduled computing. Utilizing visual expression builders and plain-English translators eliminates syntax mistakes and ensures flawless task execution.

Related Technical Guides

View all 40 guides →