Cheat Sheets · Cron Cheat Sheet · Cron Last Day of the Month — Crontab Example

Cron Last Day of the Month — Crontab Example

59 23 L * *

Runs at 23:59 on the last day of the month (28th–31st, whichever applies).

Field by field

FieldValueMeaning
Minute59At minute 59
Hour23At 11 PM
Day of monthLThe last day of the month
Month*Every month
Day of week*Any day of the week

Cron has no native "last day" number because it varies (28–31). The L character in the day-of-month field solves this — but it is an extension supported by Cronie (most Linux distros), Quartz, and some cloud schedulers, not classic POSIX cron.

The portable fallback is to run nightly and let the script decide whether tomorrow is the 1st:

59 23 * * * [ "$(date -d tomorrow +\%d)" = "01" ] && /usr/local/bin/month-end.sh

Related schedules

FAQ

My cron rejected the L — why?
Your implementation predates the L extension. Check man 5 crontab for a "L" or "last" mention; if absent, use the daily-guard fallback shown above.

Why is % doubled in the crontab line?
In crontab, a raw % starts the STDIN section of the command. Escape it as \% whenever date/format strings need a literal percent sign.

Is 23:59 chosen for a reason?
It keeps the run inside the last day. Midnight-plus-one (00:00) technically fires on the FIRST day of the next month — which breaks "last day" semantics for anything reading the date.

Stop memorizing — build it interactively

Try schedules in the Cron Editor

Full reference: Cron Cheat Sheet