Cron expressions are the universal language for scheduling automated tasks — running database backups every night, sending weekly reports, polling APIs every 5 minutes. They look cryptic ("0 0 * * *") but follow simple rules once you understand the format.
This guide explains the 5-field cron syntax, common scheduling patterns, special characters, and tips for testing schedules safely before production.
Generate Cron Expressions — Free
Visual schedule builder with next-execution preview. Perfect for backups, reports, and automation.
Cron Syntax (5 Fields)
* * * * *
| | | | |
| | | | +---- Day of week (0-7, Sunday=0 or 7)
| | | +------ Month (1-12)
| | +-------- Day of month (1-31)
| +---------- Hour (0-23)
+------------ Minute (0-59)
Special Characters
*— every value,— list (1,5,15)-— range (1-5)/— step (*/5 = every 5)?— no specific value (some systems)L— last day of month/weekW— weekday closest to date
Common Cron Patterns
| Schedule | Cron Expression |
|---|---|
| Every minute | * * * * * |
| Every 5 minutes | */5 * * * * |
| Every hour | 0 * * * * |
| Every day at midnight | 0 0 * * * |
| Every day at 3:30 AM | 30 3 * * * |
| Every Monday at 9 AM | 0 9 * * 1 |
| Every weekday at 6 PM | 0 18 * * 1-5 |
| 1st of every month | 0 0 1 * * |
| Every 15 minutes during work hours | */15 9-17 * * 1-5 |
| Twice daily (8 AM, 8 PM) | 0 8,20 * * * |
Special Cron Strings
| String | Meaning | Equivalent |
|---|---|---|
@yearly | Once a year | 0 0 1 1 * |
@monthly | Once a month | 0 0 1 * * |
@weekly | Once a week | 0 0 * * 0 |
@daily | Once a day | 0 0 * * * |
@hourly | Once an hour | 0 * * * * |
@reboot | At system startup | (varies) |
Common Cron Mistakes
- Forgetting time zone — cron uses server time; specify in code if needed
- Day of week 0 vs 7 — both = Sunday; 1=Monday in standard cron
- Long-running tasks overlapping — if task takes 6 minutes and runs every 5, multiple instances overlap
- Not redirecting output — silent failures; always log stderr/stdout
- PATH issues — cron has minimal PATH; use absolute paths
- Off-by-one in day-of-month — Feb 30 doesn't exist
A cron set to "*/1 * * * *" instead of "0 */1 * * *" runs every minute, not every hour — easy 60x oops. Use scheduling visualizers to verify intent before deploying.
How to Use the Tool (Step by Step)
- 1
Pick Schedule Frequency
Every X minutes, hourly, daily, weekly, monthly.
- 2
Set Specific Times
Hour, minute, day of week, day of month.
- 3
See Generated Expression
Tool builds cron string from your inputs.
- 4
Visualize Schedule
See next 5-10 execution times to verify intent.
- 5
Copy and Test
Add to crontab or scheduler. Test in staging before production.
Frequently Asked Questions
How do I add a cron job in Linux?+−
`crontab -e` opens your user crontab in editor. Add line, save. Job activates immediately.
Where do cron job logs go?+−
By default to system mail. Best practice: redirect output: `* * * * * /command >> /var/log/myjob.log 2>&1`
Can cron run jobs every second?+−
No, minimum is 1 minute. For sub-minute scheduling, use a script that loops with sleep, or systemd timers.
What if my server is down at scheduled time?+−
Standard cron skips missed runs. Use anacron for laptop/intermittent systems that should "catch up" on missed runs.
How to schedule based on time zone?+−
Standard cron uses server time. Set TZ environment variable in crontab: `TZ=Asia/Kolkata`
What is `@reboot`?+−
Runs the job once when system boots. Useful for starting daemons, cleaning temp files on startup.
Generate Cron Expressions — Free
Visual schedule builder with next-execution preview. Perfect for backups, reports, and automation.
Open Cron Generator ->Related Guides
Complete Cron Expression Guide
Learn cron expression syntax, special characters, common schedules, and best practices. Build any cron job visually with our free generator.
JSON Syntax Rules, Common Parse Errors and How to Fix Them
A complete developer reference for JSON syntax, common errors, formatting options, and how to validate JSON in any language or tool.
Regex Cheat Sheet With Examples
Test and debug regex patterns with real-time matching, syntax highlighting, and cheat sheet. Free, browser-based.