# Why */14 in Cron Does NOT Run Every Two Weeks (True Biweekly 14-Day Schedule)

> 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.

- **Canonical URL**: https://opslint.dev/cron/biweekly-every-two-weeks-cron-myth/
- **Category**: `CRON`
- **Interactive Workbench**: [Open in Live Workbench](https://opslint.dev/cron/#expr=0%209%20*%2F14%20*%20*&tz=UTC)
- **Normative Specifications**: `POSIX.1-2017 crontab Step Values (Field-Local Modulo Expansion)`, `Unix Epoch Day Modulo Arithmetic (86400s UTC Days)`

## Incident Symptom & Root Cause

**Production Symptom**: A team configures 0 9 */14 * * or 0 9 */14 * 1 for biweekly sprint rollovers or two-week on-call rotations, only to see the job run on January 1, January 15, January 29, and then again THREE days later on February 1!

**Protocol / Engine Root Cause**: In every cron implementation, */N is purely syntactic sugar for stepping through the allowed integers of that single field starting from its minimum value: in Day-of-Month (1–31), */14 expands literally to the static list 1,15,29 regardless of month length, resetting to day 1 on every new month! Worse, 0 9 */14 * 1 triggers the DOM/DOW OR trap and runs every Monday plus days 1, 15, and 29!

## Remediation Diff (Broken vs Verified Fix)

### Two Classic 'Biweekly' Cron Bugs

```text
# Bug 1: Expands to static days 1, 15, 29 of EVERY month!
# Fires Jan 29 -> Feb 1 (only 3 days apart!), and never hits Mondays consistently!
0 9 */14 * * /opt/ops/rotate-sprint.sh

# Bug 2: POSIX OR trap! Runs days 1, 15, 29 PLUS every single Monday!
0 9 */14 * 1 /opt/ops/rotate-sprint.sh
```

### True Every-Other-Monday (14-Day Epoch Modulo Guard)

```text
# Linux / POSIX crontab: wakes every Monday at 09:00 UTC, runs on even 14-day cycles!
# 86400s = 1 UTC day; Unix epoch 1970-01-01 was Thursday; divide by 7 or 14 days:
0 9 * * 1 [ $(( ($(date -u +%s) / 86400 / 7) % 2 )) -eq 0 ] && /opt/ops/rotate-sprint.sh

# Flip '= 0' to '= 1' if your biweekly cadence starts on the opposite Monday!

# Kubernetes / GitHub Actions run command (no % escaping needed outside crontab):
# [ $(( ($(date -u +%s) / 604800) % 2 )) -eq 0 ] || exit 0
# /opt/ops/rotate-sprint.sh
```

## Engineering Deep Dive

Cron expressions are stateless calendar-field matchers with zero memory of when a job last ran. Because months have 28, 29, 30, or 31 days—none of which is an integer multiple of 14 except non-leap February—no pure 5-field POSIX cron string can represent an unbroken 14-day cycle across month boundaries.

Using Unix epoch seconds in UTC (date -u +%s) provides a stateless, globally synchronized 14-day clock across every server and container in your fleet without needing shared database state! Dividing UTC epoch seconds by 604800 (the exact number of seconds in 7 UTC days: 7 * 86400) yields an integer week number since 1970-01-01 that increments by 1 every Thursday at 00:00:00 UTC. Checking (% 2 -eq 0) inside a Monday cron rule (0 9 * * 1) guarantees the condition is true on alternate Mondays forever across month ends, year ends, and leap years!

Notice why date -u +%s (or integer division at a fixed UTC hour away from Thursday 00:00 UTC rollover, or anchoring to an explicit reference date (epoch - ref_epoch) / 86400 % 14 == 0) is rock solid: Unix timestamps never jump forward or backward during local Daylight Saving Time transitions. If your cron fires on Monday at 09:00 America/New_York (13:00 or 14:00 UTC), integer-dividing UTC epoch seconds by 604800 lands squarely on day 4 of the epoch week in both winter and summer.

## Stepped Cron Myths vs Reality

| Case / Engine | Protocol Behavior | Production Remediation |
| :--- | :--- | :--- |
| **0 9 */14 * *** (`#myth-every-14-days`) | Expands to DOM = 1, 15, 29; gap shrinks to 3 days between Jan 29 and Feb 1. | Wake weekly on target weekday (0 9 * * 1) + epoch week parity check ((epoch / 604800) % 2 == 0). |
| **0 0 */2 * *** (`#myth-every-2-days`) | Expands to odd days 1,3,5..31; runs TWO days in a row on Jan 31 and Feb 1! | Wake daily (0 0 * * *) and guard with [ $(( ($(date -u +\%s) / 86400) \% 2 )) -eq 0 ]. |
| **Semi-monthly (24x/year vs Biweekly 26x/year)** (`#semi-monthly-1st-15th`) | 0 9 1,15 * * runs 24 times/year on fixed dates (1st & 15th), NOT every 14 days. | Confirm with finance/ops whether business logic expects semi-monthly (1,15) or biweekly (26x/yr). |
| **AWS EventBridge rate(14 days)** (`#aws-eventbridge-rate-14-days`) | Fires every 14*24h relative to rule creation/update time (drifts if Terraform recreates rule!). | Pin deterministic anchor date in code or use EventBridge Scheduler start_date + rate(14 days). |

## Frequently Asked Engineering Questions

### Why shouldn't I just use AWS EventBridge rate(14 days) for biweekly Monday jobs?

In legacy EventBridge Rules, rate(14 days) starts counting from the exact timestamp the rule was created or modified—if someone runs terraform apply on a Wednesday afternoon, your Monday payroll schedule silently shifts to alternate Wednesdays! In EventBridge Scheduler, pair rate(14 days) with an explicit StartDate anchored to Monday 09:00, or use cron(0 9 ? * MON *) with an epoch parity check inside Lambda.

### Does */2 in the Month field have the same wrap bug?

Months always run 1..12 (an even 12 months), so 0 0 1 */2 * expands cleanly to Jan, Mar, May, Jul, Sep, Nov (every 2 months without Dec->Jan collision). Odd steps like */5 in Month DO collide (1, 6, 11 -> then Jan 1 is 2 months after Nov 1).

### How do I pick which of the two Mondays matches my team's current sprint?

Run echo $(( ($(date -u +%s) / 604800) % 2 )) on a Monday that belongs to an active sprint end: if it prints 0, test -eq 0; if it prints 1, test -eq 1.

## Related Problem-Cluster Guides

- [Run a Cron Job Every 90 Minutes or Every 45 Minutes (Cross-Hour Split Pattern)](https://opslint.dev/cron/every-90-minutes-cross-hour-cron-split/) — 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.
- [The POSIX Cron Day-of-Month + Day-of-Week OR Trap (0 9 13 * 5 Runs Every Friday)](https://opslint.dev/cron/posix-dom-dow-or-boolean-trap/) — Why specifying both Day-of-Month and Day-of-Week in POSIX crontab evaluates as boolean OR (union) instead of AND, and how to guard intersection schedules.
- [Fix Crontab Percent Sign (%) Syntax Errors and Missing EOF Newline Silent Skips](https://opslint.dev/cron/crontab-percent-sign-newline-eof-pitfalls/) — Why date +%Y-%m-%d crashes inside Linux crontab with unexpected EOF while succeeding in bash, and why missing trailing newlines drop the last cron job.
- [Nearest Weekday Payroll Cron Schedules: 15W and LW vs Portable POSIX Guards](https://opslint.dev/cron/nearest-weekday-payroll-schedule-15w/) — Translate AWS EventBridge 15W and LW nearest-business-day payroll modifiers to POSIX crontab, Kubernetes CronJob, and GitHub Actions without month-crossing bugs.
