Convert Quartz to Unix cron (POSIX/Vixie)
Translate Quartz scheduler expressions to POSIX/Vixie crontab format: dropping seconds, Sunday renumbering (1→0), ? removal, and which Quartz tokens have no Unix equivalent.
About this conversion
Going from Quartz to a plain crontab is a downgrade in expressive power, and the conversion has to be honest about it. The seconds field disappears — Unix cron has minute resolution, full stop. Numeric day-of-week values shift down by one (Quartz Sunday is 1, Unix Sunday is 0). The ? token, which Quartz requires in one of the day fields, doesn't exist in Unix cron and becomes *. And Quartz's calendar tokens — L, W, # — describe schedules a five-field crontab simply cannot state.
What changes in this conversion
- The seconds field is removed. An expression firing at second 0 converts cleanly; any other seconds constraint is dropped and flagged (Unix cron fires once per minute at second 0).
- Numeric day-of-week values shift down by one (Quartz 2-6 → Unix 1-5). Day names pass through unchanged.
- ? becomes * — Unix cron has no don't-care token and no rule requiring one.
- Comma lists are recompressed where the target can say them shorter (0,15,30,45 → */15).
Worked examples
0 0 9 ? * 2-6converts to0 9 * * 1-5lossless0 15 10 * * ?converts to15 10 * * *lossless*/30 * * * * ?converts to* * * * *lossy- ⚠ POSIX has minute resolution — the seconds constraint (*/30) is dropped; fires at second 0.
Every converted expression above is produced by the same conversion engine the tool uses — generated and integrity-tested, not hand-written.
Lossy and refused conversions
Two Quartz features refuse to convert rather than converting wrongly. A sub-minute seconds pattern (like */30 in the seconds field) has no Unix equivalent — the converter flags that your twice-a-minute job becomes once-a-minute. And L/W/# calendar tokens (last day of month, nearest weekday, nth weekday) are declined outright: silently dropping "last Friday" from a schedule is a wrong-schedule bug, so the converter leaves the expression unchanged and says why. Note Quartz's own trap here: a bare L in day-of-week means Saturday, not "last something" — check what your source expression actually meant before porting it.
FAQ
What happens to L, W, and # tokens?
They don't convert. Unix cron has no equivalent for last-day, nearest-weekday, or nth-weekday scheduling, so the converter refuses instead of silently rewriting your schedule. The common workaround is scheduling wider and guarding in the job itself (e.g. testing date +%u).
My Quartz job fires every 30 seconds. What does the crontab version do?
It fires once per minute at second 0. Unix cron has minute resolution — the conversion is flagged lossy so this doesn't surprise you in production.