Glossary
Cron Expression
A string of five fields (minute, hour, day-of-month, month, day-of-week) that defines a recurring schedule for automated jobs. The asterisk (*) matches any value, ranges use hyphens, step values use slashes, and comma-separated lists match multiple values.
Cron is a time-based job scheduler built into Unix-like operating systems. It runs as a background daemon and executes scheduled commands (cron jobs) at times defined by cron expressions. Cron expressions use five (or six) fields to describe any recurring schedule from "every minute" to "the third Tuesday of every March at 2:15 AM."
Cron Expression Format
┌──── minute (0-59)
│ ┌── hour (0-23)
│ │ ┌─ day of month (1-31)
│ │ │ ┌ month (1-12)
│ │ │ │ ┌ day of week (0-7, 0 and 7 = Sunday)
│ │ │ │ │
* * * * *
Common Expressions
* * * * * Every minute
*/5 * * * * Every 5 minutes
0 * * * * Every hour
0 9 * * 1-5 Weekdays at 9 AM
0 0 * * * Daily at midnight
0 0 1 * * First day of each month
0 0 * * 0 Every Sunday at midnight
@daily Alias for "0 0 * * *"
@reboot At system startup
Special Characters
| Character | Meaning | Example |
|---|---|---|
* | Any value | * * * * * = every minute |
, | List | 1,15 = at minute 1 and 15 |
- | Range | 1-5 = 1 through 5 |
/ | Step | */10 = every 10 units |
Managing Crontabs
crontab -e # Edit your crontab
crontab -l # List your crontab
crontab -r # Remove your crontab
Debugging Tips
Cron uses a minimal environment — common failures:
- Use absolute paths for all commands and files
- Set
PATH=at the top of the crontab - Redirect output:
command >> /tmp/log.log 2>&1 - Cron does not load
.bashrcor.profile
Parse cron expressions and see the next scheduled run times with the Cron Parser Tool.