Ultimate Design Tools
/Guides
ToolsGuidesAbout
CodeApril 2026·8 min read

Complete Guide to Cron Expressions & Scheduling

Cron is the time-based job scheduler that powers automation across Unix, Linux, macOS, cloud platforms, and CI/CD pipelines. If you have ever needed to run a script at midnight, send a report every Monday, or clean up logs every hour, you have used cron.

⚡ Key Takeaways
  • Master cron expressions with this complete guide.
  • Covers 1. anatomy of a cron expression.
  • Covers 2. special characters.
  • Covers 3. common cron schedules.
  • Covers 4. common gotchas.

1. Anatomy of a Cron Expression

A standard cron expression has five fields separated by spaces: minute (0-59), hour (0-23), day of month (1-31), month (1-12), and day of week (0-6, where 0 is Sunday). Each field can be a specific value, a range, a list, a step, or a wildcard.

The five fields answer the question: at what minute, of what hour, on what day of the month, in what month, on what day of the week should this job run?

2. Special Characters

3. Common Cron Schedules

4. Common Gotchas

Day-of-month AND day-of-week

When both day-of-month and day-of-week are set to non-* values, most cron implementations use OR logic — the job runs when either condition is met. This catches many people off guard. 0 0 15 * 5 means midnight on the 15th OR every Friday, not the 15th only if it is Friday.

💡 Tip
Always include -webkit-backdrop-filter alongside backdrop-filter for Safari support. Without the prefix, the effect is invisible to roughly 25% of mobile users.

Environment variables

Cron jobs run with a minimal environment — your PATH, HOME, and other variables may not be set. Always use absolute paths in cron scripts and source your profile if needed.

Pro tip: Redirect output to a log file to debug issues: */5 * * * * /path/to/script.sh >> /var/log/myjob.log 2>&1

5. Cron Best Practices

Test Your Cron Expression

Free. No signup. Runs 100% in your browser.

Open Crontab Explainer →
✍️
Derek Giordano
Founder, Ultimate Design Tools
📚 References & Further Reading
🔗 Related Tools & Guides