← All cron schedules

Cron last day of the month

The cron expression 0 23 28-31 * * runs a job at 23:00, on days 28 through 31 of the month; a date guard in the command limits it to the last day of the month. The guard exits early on the other dates, so give the job's heartbeat monitor a period that matches the real schedule, not the cron expression.

0 23 28-31 * *
At 23:00, on days 28 through 31 of the month.
Standard cron can't express this schedule on its own; the crontab line below adds a guard in the command.
minutehourday of monthmonthday of week
02328-31**

Next runs (UTC)

  1. Wed 2026-10-28 23:00 UTC (+00:00) · in 16d 3h
  2. Thu 2026-10-29 23:00 UTC (+00:00) · in 17d 3h
  3. Fri 2026-10-30 23:00 UTC (+00:00) · in 18d 3h
  4. Sat 2026-10-31 23:00 UTC (+00:00) · in 19d 3h
  5. Sat 2026-11-28 23:00 UTC (+00:00) · in 47d 3h
  6. Sun 2026-11-29 23:00 UTC (+00:00) · in 48d 3h
  7. Mon 2026-11-30 23:00 UTC (+00:00) · in 49d 3h
  8. Mon 2026-12-28 23:00 UTC (+00:00) · in 77d 3h
  9. Tue 2026-12-29 23:00 UTC (+00:00) · in 78d 3h
  10. Wed 2026-12-30 23:00 UTC (+00:00) · in 79d 3h

These are the times cron wakes up; the guard in the command then decides whether the job actually runs.

Notes for this schedule

Standard cron has no 'last day' (L is Quartz-only). Schedule on days 28-31 and let the command check that tomorrow is the 1st.
date -d tomorrow is GNU date (Linux). On macOS/BSD use date -v+1d +\%d.
systemd timers support it natively: *-*~01 means the last day of every month.
The ping goes out on every wake-up (days 28-31), not only on the last day, so a heartbeat can use the same cron expression; if the job fails on the last day, the ping is skipped and you're alerted.

Examples

crontab (crontab -e)
0 23 28-31 * * if [ "$(date -d tomorrow +\%d)" = 01 ]; then /usr/local/bin/my-job.sh; fi && curl -fsS -m 10 --retry 3 -o /dev/null https://puzaricloud.in/ping/<your-token>
systemd timer
# /etc/systemd/system/my-job.timer
[Unit]
Description=Run my-job (last day of the month)

[Timer]
OnCalendar=*-*~01 23:00:00
Persistent=true

[Install]
WantedBy=timers.target
and the service it starts
# /etc/systemd/system/my-job.service
[Unit]
Description=my-job

[Service]
Type=oneshot
ExecStart=/usr/local/bin/my-job.sh
# runs only if ExecStart succeeded
ExecStartPost=/usr/bin/curl -fsS -m 10 --retry 3 -o /dev/null https://puzaricloud.in/ping/<your-token>

Check the calendar spec with systemd-analyze calendar "*-*~01 23:00:00", then systemctl enable --now my-job.timer. Persistent=true runs a missed job at boot.

Kubernetes CronJob
apiVersion: batch/v1
kind: CronJob
metadata:
  name: my-job
spec:
  schedule: "0 23 28-31 * *"
  timeZone: "Etc/UTC"          # Kubernetes 1.27+; otherwise the controller's timezone
  concurrencyPolicy: Forbid       # don't start a new run while one is active
  startingDeadlineSeconds: 300    # still start if the controller was briefly down
  jobTemplate:
    spec:
      backoffLimit: 2
      template:
        spec:
          restartPolicy: OnFailure
          containers:
            - name: job
              image: your-image:tag
              command: ["/bin/sh", "-c", "if [ \"$(date -d tomorrow +%d)\" = 01 ]; then /app/run-job.sh; fi && curl -fsS -m 10 --retry 3 -o /dev/null https://puzaricloud.in/ping/<your-token>"]
GitHub Actions
on:
  schedule:
    - cron: "0 23 28-31 * *"   # always evaluated in UTC
  workflow_dispatch: {}          # lets you run it by hand too

jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: "if [ \"$(date -d tomorrow +%d)\" = 01 ]; then ./run-job.sh; fi"
      - name: Tell Vigil the job ran
        if: success()
        run: curl -fsS -m 10 --retry 3 -o /dev/null https://puzaricloud.in/ping/${{ secrets.VIGIL_PING_TOKEN }}

GitHub runs schedules in UTC, can delay them at busy times, and disables scheduled workflows in public repos after 60 days without activity.

Common mistakes

Server timezone. cron uses the machine's local timezone, and most cloud VMs and containers are set to UTC. Check with timedatectl or date. cronie (RHEL, Fedora, Arch) accepts CRON_TZ=Asia/Kolkata at the top of a crontab; Debian/Ubuntu cron does not.
Daylight saving time. On DST days, local times around 01:00-03:00 are skipped or repeated. Vixie cron/cronie try to run skipped fixed-time jobs just after the jump and not twice in the repeated hour; Kubernetes, systemd and most libraries behave differently. Schedule in UTC if 'exactly once' matters.
Day-of-month OR day-of-week. If both the 3rd and 5th fields are restricted, cron runs when either matches: 0 0 13 * 5 runs on every 13th and every Friday, not only on Friday the 13th.
Unescaped %. In a crontab line, % is turned into a newline (everything after it goes to the command's stdin). Write date +\%F, not date +%F.
A different environment. cron runs with a minimal PATH (often just /usr/bin:/bin), no login shell and no .bashrc. Use absolute paths and set variables at the top of the crontab.
Silent failures. cron doesn't tell anyone when a job fails or stops running; output goes to local mail nobody reads. A heartbeat monitor that expects a ping after every run is the only reliable way to notice.

How to get alerted when it doesn't run

A cron job that stops running looks exactly like one that's working: no errors, no output. The reliable fix is a heartbeat (dead man's switch): the job pings a URL each time it finishes, and the monitor alerts you when a ping is late.

  1. Create a heartbeat in Vigil and choose cron schedule: 0 23 28-31 * *, timezone of your server.
  2. Set a grace period of about 60 minutes: long enough for a normal run to finish, short enough that you hear about it quickly.
  3. Add the ping to the end of the command (above). && means only successful runs ping; use /ping/<token>/$? to report the exit code, and /start to catch jobs that hang.

With the native systemd timer the ping only arrives on the last day itself, so give that heartbeat a fixed period of 31 days and a 1-day grace instead of the cron expression.

Watch this schedule — get alerted if it doesn't run

Related: first day of every month 0 0 1 * * · twice a month (1st and 15th) 0 0 1,15 * * · first Monday of the month 0 9 1-7 * * · every quarter 0 0 1 1,4,7,10 * · every 6 months 0 0 1 1,7 * · once a year 0 0 1 1 *
How Vigil can watch this for you

Vigil tells you when a run is missed

Vigil heartbeats understand cron expressions and timezones, so they know exactly when each run is due. Missed, failed or stuck runs alert you on email, Slack, Telegram, Discord or a webhook, and the history shows every run's duration.

Monitor this cron job free
Free plan, no card. Alerts on email, Telegram, Slack, Discord, Teams or any webhook.
More free tools: