# Run a Cron Job Every 90 Minutes or Every 45 Minutes (Cross-Hour Split Pattern)

> Why */90 and */45 fail to produce uniform cross-hour intervals in cron, and how to split 45-minute and 90-minute schedules into exact dual cron expressions.

- **Canonical URL**: https://opslint.dev/cron/every-90-minutes-cross-hour-cron-split/
- **Category**: `CRON`
- **Interactive Workbench**: [Open in Live Workbench](https://opslint.dev/cron/#expr=0%200-21%2F3%20*%20*%20*&tz=UTC)
- **Normative Specifications**: `POSIX.1-2017 crontab Minute (0-59) & Hour (0-23) Field Bounds`, `systemd.timer(5) OnUnitActiveSec=90min Monotonic Alternative`

## Incident Symptom & Root Cause

**Production Symptom**: Writing */90 * * * * fails immediately with 'bad minute' (since minutes cap at 59), while writing */45 * * * * executes at :00, :45, and then AGAIN 15 minutes later at :00 of the next hour (producing an uneven 45m / 15m / 45m / 15m sawtooth pattern!).

**Protocol / Engine Root Cause**: Cron minute steps reset to 0 at every hour boundary unless 60 is evenly divisible by N (only 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, and 30 divide 60 evenly!). Any interval whose least common multiple with 60 spans multiple hours (such as 45m -> 3h cycle, or 90m -> 3h cycle) must split across multiple cron lines grouped by hour residue.

## Remediation Diff (Broken vs Verified Fix)

### Invalid */90 Syntax & Uneven */45 Sawtooth Bug

```text
# ERROR: 90 exceeds minute field maximum (0-59) -> rejected by crontab!
*/90 * * * * /opt/sync/incremental-pull.sh

# SILENT BUG: Fires at 00:00, 00:45, 01:00 (15m gap!), 01:45, 02:00 (15m gap!)
*/45 * * * * /opt/sync/incremental-pull.sh
```

### Exact Uniform 90-Minute (2 Lines) & 45-Minute (3 Lines) Splits

```text
# === Exact Every 90 Minutes (16 uniform runs/day: 00:00, 01:30, 03:00, 04:30 ... 22:30) ===
0  0-21/3 * * * /opt/sync/incremental-pull.sh
30 1-22/3 * * * /opt/sync/incremental-pull.sh

# (In POSIX crontabs without range-step 0-21/3, use explicit hours:)
# 0  0,3,6,9,12,15,18,21 * * * /opt/sync/incremental-pull.sh
# 30 1,4,7,10,13,16,19,22 * * * /opt/sync/incremental-pull.sh

# === Exact Every 45 Minutes (32 uniform runs/day across 3-hour LCM cycle) ===
0,45 0,3,6,9,12,15,18,21  * * * /opt/sync/incremental-pull.sh
30   1,4,7,10,13,16,19,22 * * * /opt/sync/incremental-pull.sh
15   2,5,8,11,14,17,20,23 * * * /opt/sync/incremental-pull.sh
```

## Engineering Deep Dive

Whenever you need an exact every-M-minutes schedule in standard cron, compute LCM(M, 60) to find when the minute offset realigns to :00—and confirm that 1440 (the number of minutes in a 24-hour UTC day) is also divisible by M so midnight does not introduce a seam! Both 90 minutes (1440 / 90 = 16 runs/day, LCM = 180m = 3 hours) and 45 minutes (1440 / 45 = 32 runs/day, LCM = 180m = 3 hours) tile a 24-hour UTC day with zero drift!

Look at how cleanly the 3-hour cycle decomposes for 90 minutes: in hours congruent to 0 mod 3 (0, 3, 6, 9, 12, 15, 18, 21), the job fires at :00; 90 minutes later lands in hours congruent to 1 mod 3 (1, 4, 7, 10, 13, 16, 19, 22) at :30; and 90 minutes after :30 lands in the next 0-mod-3 hour at :00! Hours congruent to 2 mod 3 (2, 5, 8...) contain zero runs. Two cron entries therefore express a mathematically exact 90-minute schedule across every cron dialect on earth (POSIX, GitHub Actions, Kubernetes, EventBridge, and Cloudflare Workers).

Crucially, run cross-hour split schedules in UTC (not a DST-observing local timezone): during spring forward or fall back, a 23-hour or 25-hour local day breaks 3-hour modulo continuity at 02:00. Alternatively, on Linux systemd or AWS EventBridge, monotonic interval timers (OnUnitActiveSec=90min in systemd or rate(90 minutes) in EventBridge) express arbitrary non-60-divisor intervals in a single line.

## Divisor Rule for */N Minute Cron Expressions

| Case / Engine | Protocol Behavior | Production Remediation |
| :--- | :--- | :--- |
| **N divides 60 (1,2,3,4,5,6,10,12,15,20,30)** (`#exact-60-divisors`) | */N * * * * produces completely uniform N-minute intervals across every hour. | Single cron rule works natively with zero hour-boundary sawtooth. |
| **Every 40 minutes (LCM=120m, 2h cycle)** (`#every-40-minutes`) | */40 fires at :00, :40, :00 (40m then 20m gap!). | Split into 2 lines: '0,40 */2 * * *' (even hours) and '20 1-23/2 * * *' (odd hours) in UTC. |
| **Every 45 minutes (LCM=180m, 3h cycle)** (`#every-45-minutes`) | */45 fires at :00, :45, :00 (45m then 15m gap!). | Split into 3 lines across hours mod 3 (:00,:45 on h%3==0; :30 on h%3==1; :15 on h%3==2). |
| **Every 90 minutes (LCM=180m, 3h cycle)** (`#every-90-minutes`) | */90 is a syntax error (max minute is 59). | Split into 2 lines: '0 0,3,6,9,12,15,18,21 * * *' and '30 1,4,7,10,13,16,19,22 * * *' in UTC. |

## Frequently Asked Engineering Questions

### Can I express every 7 minutes or every 25 minutes cleanly with split cron lines?

No, because neither 7 nor 25 divides 1440 (minutes in a day), so midnight UTC would always create an uneven gap even if you wrote 24 separate lines! For non-divisors of 1440, trigger * * * * * (every minute) with a lightweight epoch guard [ $(( ($(date -u +\%s) / 60) \% 25 )) -eq 0 ] or use systemd OnUnitActiveSec=25min / EventBridge rate(25 minutes).

### Is 1-22/3 portable across all cron parsers?

Vixie Cron, Cronie, Kubernetes robfig/cron, and GitHub Actions all support range-with-step (1-22/3), whereas a few strict legacy SysV parsers reject steps on ranges—writing the explicit list 1,4,7,10,13,16,19,22 is short and 100% universally portable.

### If I split a job across two Kubernetes CronJob objects (:00 and :30), can they overlap?

Two separate Kubernetes CronJob objects do NOT share concurrencyPolicy state! If a run can ever exceed 90 minutes, add a distributed DB advisory lock or combine into an hourly/30m CronJob with an internal modulo check so one CronJob controller enforces concurrencyPolicy: Forbid.

## Related Problem-Cluster Guides

- [Why */14 in Cron Does NOT Run Every Two Weeks (True Biweekly 14-Day Schedule)](https://opslint.dev/cron/biweekly-every-two-weeks-cron-myth/) — Understand why 0 9 */14 * * resets at every month boundary (running on the 29th AND the 1st), and implement true 14-day biweekly cadence with epoch arithmetic.
- [Schedule Cron Jobs for Market Hours (09:30–16:00 Mon–Fri in America/New_York)](https://opslint.dev/cron/business-hours-market-open-half-hour-cron/) — Why a single cron expression cannot start at 09:30 and end at 16:00 without skipping :00–:29 in later hours, and how to split half-hour trading windows cleanly.
- [systemd OnCalendar vs POSIX Cron: AND Logic, Reverse Offsets (~), and Persistent=true](https://opslint.dev/cron/systemd-oncalendar-to-cron-and-logic-differences/) — Avoid critical translation bugs between systemd.timer OnCalendar expressions and 5-field POSIX cron, including DOM+DOW intersection, seconds, and missed boot catch-up.
- [Prevent Overlapping Cron Jobs with Linux flock -n Non-Blocking Locks](https://opslint.dev/cron/flock-prevent-overlapping-cron-flock-wrappers/) — Stop runaway duplicate cron processes and database lock pileups using kernel-managed util-linux flock -n file descriptors instead of brittle PID files.
