⌨️Cron Expression
Also known as Cron Schedule, Cron Syntax, Crontab Syntax
Five fields that say when a scheduled job runs, like 0 3 * * *.
Think of it like
Think of it like a school timetable written in code. Each box says which day and hour.
Example
Jack wants a report at 9:30 on weekdays. He writes 30 9 * * 1-5, which means minute 30 of hour 9, Monday to Friday.
Why it matters
One wrong field can run a job every minute instead of once a day.
Definition
Example code
console
$ crontab -l
30 9 * * 1-5 /home/jack/report.sh
*/15 * * * * /home/jack/check.shCommon mistake
Key takeaways
- 1Five fields. Minute, hour, day, month, weekday.
- 2Star means every. Any value matches.
- 3Minute first. Not the hour.