Cron job on the last day of the month
To run a cron job on the last day of the month, use 0 0 28-31 * *. In plain English: at 00:00, on days 28 through 31 of the month. That is 3.4 times a month.
Standard cron has no "last day" operator. Schedule it on days 28-31 and exit early unless tomorrow is the 1st: [ "$(date -d tomorrow +\%d)" = "01" ] && /job.sh (GNU date).
“At 00:00, on days 28 through 31 of the month”
Next runs
- Calculating…
Cron fails silently. Add one curl line and we’ll email you the minute a run is missed.
What each field means
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 | 0 |
| Hour | 0 | 00:00 |
| Day of month | 28-31 | 28 through 31 |
| Month | * | every month |
| Day of week | * | every day of week |
Copy-paste examples
Each example ends with a heartbeat ping, so you hear about it when a run is missed. Get your ping URL (free).
# crontab -e
0 0 28-31 * * /path/to/job.sh && curl -fsS -m 10 --retry 3 https://croncanary.xyz/ping/YOUR-PING-TOKEN > /dev/null
# report failures too:
0 0 28-31 * * /path/to/job.sh && curl -fsS -m 10 https://croncanary.xyz/ping/YOUR-PING-TOKEN || curl -fsS -m 10 https://croncanary.xyz/ping/YOUR-PING-TOKEN/fail⚠︎ crontab uses the server's local time zone (or CRON_TZ / TZ if set).
on:
schedule:
- cron: '0 0 28-31 * *'
jobs:
last-day-of-the-month:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./job.sh
- if: success()
run: curl -fsS -m 10 --retry 3 https://croncanary.xyz/ping/YOUR-PING-TOKEN
- if: failure()
run: curl -fsS -m 10 https://croncanary.xyz/ping/YOUR-PING-TOKEN/fail⚠︎ GitHub Actions schedules run in UTC and can be delayed under load. A missed or late run is exactly what monitoring catches.
apiVersion: batch/v1
kind: CronJob
metadata:
name: last-day-of-the-month
spec:
schedule: "0 0 28-31 * *"
timeZone: "Etc/UTC"
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: job
image: your-image:latest
command: ["/bin/sh", "-c", "./job.sh && wget -qO- https://croncanary.xyz/ping/YOUR-PING-TOKEN"]{
"crons": [{ "path": "/api/last-day-of-the-month", "schedule": "0 0 28-31 * *" }]
}
// at the end of your /api/last-day-of-the-month handler:
await fetch("https://croncanary.xyz/ping/YOUR-PING-TOKEN");⚠︎ Vercel Cron runs in UTC.
Your job runs on the last day of the month. Will you know when it doesn’t?
Backups that stopped weeks ago, invoices that never went out, a cache that quietly went stale. Add a single curl line and you get an email the minute a run is missed, plus another when it recovers.
5 monitors free forever · no credit card · 30-second setup
- 1Create a monitorPaste your schedule. We work out when each ping should arrive.
- 2Add the pingcurl your unique URL at the end of the job.
- 3Get alertedA ping is late or reports a failure, and you get an email or Slack message.
FAQ
- What is the cron expression for on the last day of the month?
- Standard cron has no "last day" operator. Schedule it on days 28-31 and exit early unless tomorrow is the 1st: [ "$(date -d tomorrow +\%d)" = "01" ] && /job.sh (GNU date). The closest single expression is 0 0 28-31 * *.
- Which time zone does "0 0 28-31 * *" run in?
- It depends on the scheduler. crontab uses the server's local time zone (or CRON_TZ when set). GitHub Actions and Vercel Cron always use UTC. Kubernetes uses UTC unless you set spec.timeZone.
- How do I know if my cron job on the last day of the month stopped running?
- Cron doesn't tell you when a job fails or never starts. Add a heartbeat: after the job succeeds, request a unique ping URL. CronCanary expects that ping 3.4 times a month and emails you if it doesn't arrive on time. The first 5 monitors are free.