flashman
← All posts

Quartz versus Unix cron field debugging

Debug jobs that fire on the wrong cadence by separating Quartz seconds fields from Unix five-field cron, weekday numbers, time zones, and special characters.

2026-09-29 · 6 min read · Rahul Chitturi

  • cron
  • scheduling
  • production

A Unix cron expression has five fields beginning with minute. Quartz, and several schedulers built on it, add a leading seconds field and often an optional year. Pasting one dialect into the other shifts every field.

The expression 0 2 * * * means 02:00 every day in classic cron. A six-field reader can treat it as invalid, or a seconds prefix added for the wrong dialect can run at minute 2 of every hour.

Name the parser before interpreting fields

Record the product, version, field count, time zone, and the expression exactly as stored. Kubernetes CronJob uses five fields. Spring and Quartz commonly use six. Jenkins adds its own hashed syntax. Do not translate until the parser is known.

  • Count fields in the stored string.
  • Check whether day-of-week 0 and 7 are Sunday.
  • Note Quartz question marks, L, W, and # tokens.
  • Confirm the scheduler clock, not the laptop clock.

Watch weekday numbers and both day fields

Unix cron often treats 0 or 7 as Sunday. Quartz numbers Sunday as 1 and Saturday as 7. A job moved between systems can run a day early without any change to the hour.

Quartz does not allow both day-of-month and day-of-week to be unrestricted stars in the usual six-field form; one of them is ?. A Unix expression that sets both fields has OR semantics on many platforms. Those are different contracts.

Preview the next runs in the target dialect

Use Flashman's cron helper to preview a five-field expression, the timestamp converter to pin the scheduler time zone, diff to compare the old and new strings, and the Markdown editor to record the human meaning next to the expression.

Write the intended runs in words, then encode them for the real parser. Test a daylight-saving boundary and one weekday before deploying the shifted expression.

Try these tools