---
title: "Cron last day of the month: crontab workaround"
url: "https://cronmissed.com/cron/last-day-of-the-month.md"
canonical_url: "https://cronmissed.com/cron/last-day-of-the-month"
last_updated: "2026-10-22"
type: "reference"
summary: "Unix cron has no way to say the last day of the month. A one-line crontab test can. Here is the line, how it works and how to watch it."
related: ["https://cronmissed.com/cron.md", "https://cronmissed.com/cron/every-90-minutes.md", "https://cronmissed.com/cron/first-monday-of-the-month.md", "https://cronmissed.com/cron/every-30-seconds.md", "https://cronmissed.com/tools/cron-explainer.md"]
---

# Cron last day of the month: crontab workaround

> **For AI agents:** the complete index of CronMissed pages is [llms.txt](https://cronmissed.com/llms.txt). Every page is also served as markdown at its URL plus .md.

Unix cron has no way to say the last day of the month. A one-line crontab test can. Here is the line, how it works and how to watch it.

`0 0 28-31 * *`: At 00:00, on days 28 through 31 of the month.

## How do you run a job last day of the month with cron?

The line runs on every day that could be the last one, the 28th to the 31st, and the test lets the job through only when tomorrow is the 1st. In a crontab, % must be written as \%.

```crontab
0 0 28-31 * * [ "$(date -d tomorrow +\%d)" = 01 ] && /usr/local/bin/job.sh
```

## What does 0 0 28-31 * * mean?

| Field | Written | Means |
| --- | --- | --- |
| minute | `0` | 0 |
| hour | `0` | 0 |
| day of month | `28-31` | 28 through 31 |
| month | `*` | every month |
| day of week | `*` | every day of week |

## How often does it run?

On a day it runs, it runs once. It runs on 41 days of 2027, 41 runs in all. The gap between runs is not constant: it varies from 1 day to 28 days.

## When is this schedule useful?

End-of-month closing: final invoices, month-end snapshots and reports that must include every day of the month.

## What should you watch out for?

The test uses GNU date. On macOS and BSD, write date -v+1d +%d instead of date -d tomorrow +%d.

## What happens when the clocks change?

On Sunday 14 March 2027, clocks in America/New_York jump from 02:00 to 03:00. This schedule does not run that day, so the change does not touch it.

On Sunday 1 November 2026, clocks in America/New_York fall back from 02:00 to 01:00, so the hour from 01:00 happens twice. This schedule does not run that day, so the change does not touch it.

A server that keeps its clock on UTC never sees either change.

## How do you get an alert when it stops running?

Create a OnCalendar check with the schedule *-*~01 00:00 and 5 minutes of grace, and ping it at the end of the job:

```crontab
0 0 28-31 * * [ "$(date -d tomorrow +\%d)" = 01 ] && /usr/local/bin/job.sh && curl -fsS --max-time 10 --retry 5 --retry-connrefused -o /dev/null "https://ping.cronmissed.com/5f0c1b2e-7a3d-4c8e-9b61-2d4f8a7e3c10"
```

The [snippet builder](https://cronmissed.com/tools/snippet-builder.md) writes the same ping for systemd, GitHub Actions, Vercel, Kubernetes and backup scripts.

## More schedules one cron line cannot write schedules

- [Every 90 minutes](https://cronmissed.com/cron/every-90-minutes.md): `0 0-21/3 * * *`
- [First Monday of the month](https://cronmissed.com/cron/first-monday-of-the-month.md): `0 9 1-7 * *`
- [Every 30 seconds](https://cronmissed.com/cron/every-30-seconds.md): `* * * * *`
- [Every two weeks](https://cronmissed.com/cron/every-two-weeks.md): `0 9 * * 1`

## Related

- [Cron expression and crontab examples](https://cronmissed.com/cron.md)
- [Cron every 90 minutes: crontab workaround](https://cronmissed.com/cron/every-90-minutes.md)
- [Cron first Monday of the month](https://cronmissed.com/cron/first-monday-of-the-month.md)
- [Cron every 30 seconds: crontab workaround](https://cronmissed.com/cron/every-30-seconds.md)
- [Cron expression translator and evaluator](https://cronmissed.com/tools/cron-explainer.md)
