
How to Build Cron Expressions for Task Scheduling
A cron expression is a five-field string — minute, hour, day-of-month, month, day-of-week — that tells a Unix-like operating system when to run scheduled tasks automatically. Special characters like asterisk for “every”, comma for lists, and slash for intervals give fine-grained control. A visual cron expression builder translates this cryptic syntax into human-readable descriptions, eliminating the need to memorize field positions and special-character rules.
Cron is the Unix task scheduler that runs scripts, backups, and maintenance jobs at specified times. But cron syntax โ those five fields of numbers and asterisks โ is cryptic even for experienced developers. A visual cron builder translates your intent into correct syntax and explains it in plain English.
Understanding cron syntax
A cron expression has five fields: minute (0-59), hour (0-23), day of month (1-31), month (1-12), and day of week (0-6, where 0 is Sunday). An asterisk means "every." So 0 2 * * * means "at 2:00 AM every day." The ToolStand Cron Expression Builder provides a visual interface โ select values from dropdowns, and the builder constructs the expression while showing a human-readable description.
Common cron schedules
Every minute: * * * * * โ for development and testing only. Every hour: 0 * * * * โ good for hourly data syncs. Daily at midnight: 0 0 * * * โ database backups. Weekly on Monday at 3 AM: 0 3 * * 1 โ weekly reports. First day of month: 0 0 1 * * โ monthly invoicing. Every 15 minutes: */15 * * * * โ health checks and monitoring.
Special characters
Asterisk (*) : Every value. Comma (,): List of values โ 1,3,5 means days 1, 3, and 5. Hyphen (-): Range โ 1-5 means Monday through Friday. Slash (/): Step โ */5 means every 5 units. The cron builder handles these special characters visually, so you do not need to memorize the syntax.
Day-of-week and day-of-month interaction: the #1 footgun
When both day-of-month and day-of-week are specified (e.g., 0 0 1 * 1 for “midnight on the 1st AND on Monday”), cron fires on EITHER condition — this is OR logic, not AND. Most users expect it to fire only on Mondays that are also the 1st. To achieve true AND logic, use a wrapper script: [ $(date +%d) -eq 1 ] && [ $(date +%u) -eq 1 ] && your_command. The Cron Expression Builder shows the plain-English meaning so you catch this before deployment.
DST and timezone quicksand
When clocks spring forward in March, a cron job scheduled at 2:30 AM simply never runs — that hour does not exist. When clocks fall back in November, 1:30 AM runs twice. For systems spanning multiple timezones or countries with different DST dates, this causes subtle production bugs. Recommendation: schedule critical jobs outside the 1:00-3:00 AM window, or use UTC cron exclusively and convert to local time in your application layer.
Cross-platform cron dialect cheat-sheet
Five platforms use five-field cron but with subtle differences. Vixie cron (Linux): Standard syntax. Quartz Scheduler (Java): Adds an optional seconds field at position 0. AWS EventBridge: Uses six fields (includes year). GitHub Actions: Five fields but comma-separated day-of-week list. Kubernetes CronJob: Standard syntax plus timeZone field in the spec. Always verify your expression against the target platform.
Frequently asked questions about cron expressions
What does */5 * * * * mean?
Run every 5 minutes. The */5 in the minute field means “every value divisible by 5” — equivalent to 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55.
How do I run a job on the last day of the month?
Standard cron cannot express this natively. Schedule on days 28-31 and add a wrapper check: [ $(date -d tomorrow +%d) -eq 1 ] && your_command.
Why didn’t my cron job run at 2:30 AM during daylight saving?
On the spring-forward day, 2:30 AM does not exist — the clock jumps from 1:59 to 3:00. Cron silently skips the missing hour. In fall-back, 1:30 AM runs twice.
What’s the difference between 0 0 * * 0 and 0 0 * * 7?
Both mean Sunday — cron accepts both 0 and 7 for Sunday. Using 0 is more common and portable across systems.
How do I schedule a job every other hour?
Use 0 */2 * * * — the */2 in the hour field means 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22. For odd hours starting at 1 AM, use 0 1-23/2 * * *.
Does cron run if the computer was asleep at the scheduled time?
No — cron does not catch up on missed jobs. If the machine was suspended or powered off, the missed execution is gone. For catch-up behavior, use anacron or systemd timers with Persistent=true.
Explore all 109 free tools at toolstand.io. Free, forever. No sign-up. No download. Just tools that work.