2026-09-29 · 8 min read
- cron
- scheduling
- production
Cron text is not one language. Classic Unix cron uses five fields starting at minute. Quartz uses six fields starting at second, with an optional year, different weekday numbers, and extra tokens such as ? and L.
Copying an expression between Kubernetes, a system crontab, Spring, and Jenkins without naming the dialect is how a daily job becomes an hourly job.
Pin the dialect next to the expression
Store the scheduler product, version, time zone, and field order in the same change as the expression. Write the intended schedule in a sentence a reviewer can check without memorizing either syntax.
- Five fields: minute, hour, day of month, month, day of week.
- Quartz six fields add seconds at the front.
- Do not assume a library accepts both lengths.
- Keep one production parser per expression.
Translate weekdays explicitly
On many Unix systems, 0 and 7 both mean Sunday. In Quartz, 1 is Sunday and 7 is Saturday. Names such as SUN are safer when the parser supports them, but still confirm the parser's table.
Also record whether both day-of-month and day-of-week can be set. Unix often ORs them. Quartz uses ? so that one of the two fields is unspecified. A mechanical prefix of 0 does not preserve that meaning.
Treat special characters as dialect features
Quartz L, W, and # do not exist in standard cron. Jenkins H spreads load with a hash. A portable subset is numbers, stars, ranges, lists, and steps, plus an explicit seconds policy.
If you need last-day-of-month or nth-weekday behavior, implement it in the scheduler that documents it and test February and leap years. Do not expect a five-field helper to preview those tokens.
Bind the schedule to a clock
Write the time zone in the job definition. UTC avoids daylight-saving skips and repeats. Local time needs a documented rule for the missing hour and the repeated hour.
Preview the next several runs from a fixed timestamp in that zone. Compare the preview with the sentence in the change request before deploy.
Review with a next-run checklist
Use Flashman's cron helper for five-field previews, the timestamp converter for the zone, diff for the expression change, the Markdown editor for the human schedule, and the JSON formatter if the scheduler stores the job as structured config.
Test field count rejection, a Sunday boundary, a daylight-saving transition, a step expression, and a copy from Unix into Quartz that must not silently shift minutes into seconds.