Quarterly Cron Schedules: Calendar Quarter Starts vs Fiscal Quarter-End Closes
Avoid off-by-one month bugs in */3 quarterly cron expressions, align custom fiscal quarters (Feb/May/Aug/Nov), and handle uneven 30/31-day quarter-end closes.
Incident Symptom & Protocol Root Cause
Production Failure Symptom
An engineer writes 0 0 31 3,6,9,12 * for quarter-end financial reporting and completely misses Q2 (June 30) and Q3 (September 30)! Or a SaaS company on a February 1 fiscal year writes */3 expecting May/Aug/Nov/Feb and triggers on Jan/Apr/Jul/Oct instead.
Scheduler Parser & Clock Mechanics
In the Month field (1–12), */3 starts from the field minimum (1 = January), expanding strictly to 1,4,7,10 (calendar quarter starts, NOT quarter ends 3,6,9,12, and NOT custom fiscal quarters like 2,5,8,11). Meanwhile, quarter-end months alternate between 31 days (March 31, December 31) and 30 days (June 30, September 30).
Broken vs Verified Configuration
# BUG 1: Skips Q2 (June has 30 days) and Q3 (September has 30 days)!
55 23 31 3,6,9,12 * /opt/finance/quarter-close.sh
# BUG 2: */3 expands to Jan, Apr, Jul, Oct (1,4,7,10), NOT Mar, Jun, Sep, Dec!
0 0 1 */3 * /opt/finance/q-end-summary.sh# Pattern A (Recommended): Run 5 minutes into Day 1 of the new quarter (Q1..Q4 closed!)
# Explicit 1,4,7,10 is clearer and safer than */3:
5 0 1 1,4,7,10 * /opt/finance/close-previous-quarter.sh
# Pattern B: Exact 23:55 on last calendar day of Q1(Mar 31), Q2(Jun 30), Q3(Sep 30), Q4(Dec 31):
55 23 31 3,12 * /opt/finance/quarter-snapshot.sh
55 23 30 6,9 * /opt/finance/quarter-snapshot.sh
# Pattern C: Custom SaaS Fiscal Year starting Feb 1 (FY Quarters: Feb, May, Aug, Nov):
5 0 1 2,5,8,11 * /opt/finance/fiscal-quarter-rollover.shOperational Deep Dive
Unlike February (which oscillates between 28 and 29 days in leap years), the four standard calendar quarter-end months—March (31), June (30), September (30), and December (31)—have fixed lengths in every single year! That means even if a legacy system demands a snapshot at 23:55 on the final day of each calendar quarter, a static two-line split (day 31 in months 3,12 and day 30 in months 6,9) is 100% deterministic forever without needing shell date guards (unless your fiscal quarters end in February!).
Even better, financial engineering best practice favors running period-close aggregations right AFTER the boundary (such as 5 0 1 1,4,7,10 * at 00:05 on January 1, April 1, July 1, and October 1) and querying WHERE created_at >= quarter_start AND created_at < current_quarter_start. That single cron line works identically across POSIX cron, Kubernetes, GitHub Actions, EventBridge (cron(5 0 1 1,4,7,10 ? *)), PostgreSQL pg_cron, and systemd (OnCalendar=quarterly), and guarantees zero missed transactions between 23:55:00 and 23:59:59.999!
Always write explicit comma-separated month lists (1,4,7,10 or 3,6,9,12 or 2,5,8,11) rather than step syntax like */3 or 3-12/3. Explicit lists take the same 8 bytes of text and eliminate the perennial code-review confusion over whether */3 runs in January or March.
Calendar & Fiscal Quarter Cron Reference
| Engine / Case | Runtime Behavior | Production Remediation |
|---|---|---|
| Start of Q1, Q2, Q3, Q4 (Jan 1, Apr 1, Jul 1, Oct 1) | Runs once per quarter immediately after the prior quarter closes. | 5 0 1 1,4,7,10 * (EventBridge: cron(5 0 1 JAN,APR,JUL,OCT ? *)) |
| Last day of Q1–Q4 (Mar 31, Jun 30, Sep 30, Dec 31) | Fixed month lengths (never involves Feb 28/29!). | Two rules: '55 23 31 3,12 *' and '55 23 30 6,9 *' (or systemd *-03,06,09,12-~01). |
| SaaS Feb–Jan Fiscal Quarters (End Apr 30, Jul 31, Oct 31, Jan 31) | Also avoids February month-end! Start dates are Feb 1, May 1, Aug 1, Nov 1. | Quarter start: 5 0 1 2,5,8,11 * | Quarter end: 30 in month 4 + 31 in months 1,7,10. |
| Fiscal Quarters ending Feb 28/29, May 31, Aug 31, Nov 30 | Includes February month-end, so static day 28 breaks in leap years! | Run at start of next quarter (5 0 1 3,6,9,12 *) or use EventBridge 'L' / tomorrow guard. |
Edge Cases & Engineering FAQs
What does @quarterly or systemd OnCalendar=quarterly expand to?
In systemd, OnCalendar=quarterly is strictly equivalent to *-01,04,07,10-01 00:00:00 (midnight at the start of Jan 1, Apr 1, Jul 1, Oct 1). Note that POSIX crontab does NOT standardize @quarterly (only Vixie @yearly/@monthly/@weekly/@daily/@hourly are widely portable), so write 0 0 1 1,4,7,10 * explicitly.
Does 3/3 in the Month field work in POSIX crontab for Mar, Jun, Sep, Dec?
No! In standard Vixie Cron, 3/3 is a syntax error (steps require a range like 3-12/3 or wildcard */3), whereas in Quartz/EventBridge 3/3 means 'start at 3, step by 3'. Writing 3,6,9,12 works identically in 100% of parsers with zero ambiguity.
What timezone should quarterly financial close jobs use?
Match the exact timezone stated in your customer contracts and general ledger (commonly Etc/UTC for SaaS usage metering, or America/New_York / Europe/London for statutory accounting cutoffs).
Runtime Dead-Man's-Switch Verification
Dead-man's-switch heartbeat checks that page on-call when a scheduled job skips a DST gap, stalls on a lock, or exits non-zero.