Skip to main content
ToolNara
developer6 min read2026-09-15

How Linux Crontab Works: 5-Field Syntax, Step Intervals & Schedule Guide

A hands-on engineering guide to POSIX cron syntax, step intervals, UTC timezone traps, and practical cron expressions for Linux automation.

RJRana JawadPrincipal Systems Architect
LinuxDevOpsCronPOSIXAutomation

Key takeaways

  • Standard POSIX crontab uses 5 whitespace-separated fields: Minute, Hour, Day of Month, Month, and Day of Week.
  • Cron evaluates against system clock time. Always check whether your server runs in UTC before setting schedules.
  • Subshells spawned by cron do not inherit login environment variables (.bashrc). Always use absolute paths for scripts and binaries.
  • Step intervals like */15 execute on clock modulo divisions (:00, :15, :30, :45), not every 15 minutes from boot.

Companion utility

Try Cron Expression Generator & Crontab Schedule Builder

Use the browser utility for the same task, then return here for the implementation details.

Open tool

1. Anatomy of the Standard 5-Field Crontab

I have lost count of how many 3 AM pager duty incidents in my career came down to a simple misunderstanding of the POSIX crontab syntax. In Unix and Linux systems, the cron daemon (crond) wakes up every minute, checks crontab configuration tables, and parses five whitespace-separated time and date fields. From left to right, the standard 5 fields are: 1. Minute (0 to 59) 2. Hour (0 to 23, in 24-hour format) 3. Day of the Month (1 to 31) 4. Month of the Year (1 to 12, or JAN to DEC) 5. Day of the Week (0 to 6, where 0 is Sunday, or SUN to SAT) An asterisk (*) acts as a wildcard, meaning every possible value for that column. If you place an asterisk in all five positions (* * * * *), the job executes every single minute of every day.

2. Understanding Step Operators, Ranges, and Lists

When building scheduled background tasks, you rarely want a task running every single minute. The crontab specification gives us four arithmetic operators: - The Slash Operator (/): Defines step intervals. For instance, */15 in the minute column tells cron to execute when the minute value is divisible by 15 (:00, :15, :30, and :45). - The Hyphen Operator (-): Defines an inclusive range. For example, 9-17 in the hour field targets business hours from 9:00 AM through 5:00 PM. - The Comma Operator (,): Specifies an explicit list of discrete values. Putting 1,15 in the Day of Month column triggers the task only on the 1st and 15th of the month. - The Wildcard (*): Matches any value.

bashTested reference
# Run database backup every night at 02:30 AM
30 2 * * * /usr/local/bin/backup-db.sh >> /var/log/backup.log 2>&1

# Run API health check every 5 minutes during weekday business hours (UTC)
*/5 9-17 * * 1-5 /opt/monitoring/ping-api.sh > /dev/null 2>&1

3. The Two Production Pitfalls That Break Cron Jobs

In production environments, two recurring pitfalls account for many cron failures: First: System Timezone Drift. Crond evaluates rules against the host system clock. If your production Linux instance is set to UTC (which is standard practice for cloud servers) but you wrote your schedule thinking in your local time zone, your task will fire hours earlier or later than intended. Always run the 'timedatectl' command on your server to verify the active timezone before committing your crontab. Second: Missing Environment Variables. Cron jobs run in a stripped, non-interactive subshell. They do not load your personal .bashrc, .zshrc, or system PATH variables. If your script relies on node, python3, or docker, calling 'python3 script.py' will fail with command not found. Always specify the full absolute path, such as '/usr/bin/python3 /opt/app/worker.py', or source your environment file directly inside the script.

Advertisement
Advertisement placement reserved for editorial content
RJ

Rana Jawad

Principal Systems Architect at ToolNara. The guides focus on browser runtime behavior, standards, and engineering trade-offs.

View author profile

Related guides

Back to all guides