Reading a cron expression
Cron syntax is five space-separated fields describing when a job should run. Each field accepts an asterisk for “every”, a single number, a comma-separated list, a range with a hyphen, or a step with a slash. They combine, so 0 9-17/2 * * 1-5 means every two hours between 9am and 5pm on weekdays.
The day-of-month and day-of-week trap
This is the one that catches experienced people. When both the day-of-month and day-of-week fields are restricted, cron runs the job if either matches, not both. 0 0 13 * 5 runs on the 13th of every month and on every Friday — not only on Friday the 13th. If you need an AND, leave one field as * and check the other condition inside your script.
Practical advice
- Avoid scheduling everything at
0 0. Spreading jobs across the hour keeps a server from being hammered on the hour, every hour. - Be careful in the 1am–3am window if your server observes daylight saving. A job at 2:30am can run twice or be skipped entirely.
- Cron does not prevent overlap. If a job takes longer than its interval, you get two copies running — use a lock file if that matters.
To convert the timestamps that appear in job logs, use the Unix timestamp converter.