crontool
Paste a schedule, read it in English, see the next runs.

Run a Cron Job on the Last Sunday of the Month

Cron has no built-in 'last Sunday' token, so you check inside the command that the next week is a new month. Run it every Sunday and guard with a date test.

The problem

Standard cron can pick the last day of the month or a weekday, but not 'the last Sunday'. You schedule it for every Sunday and let the command decide.

The crontab line

Run at 02:00 every Sunday, but only act if there is no Sunday left this month:

0 2 * * 0 [ $(date +\%d -d '+7 days') -le 7 ] && /path/job.sh

If today plus 7 days lands in the first week (day ≤ 7), this is the last Sunday of the month.

Why it works

Any Sunday whose date one week later is 1-7 must be the final Sunday, because the following Sunday falls in the next month.

FAQ

How do I run cron on the last Sunday of the month?

Schedule 0 2 * * 0 (every Sunday) and guard the command with [ $(date +%d -d '+7 days') -le 7 ] so it only runs when next Sunday is in a new month.

Why can't cron pick the last Sunday directly?

Cron has no 'last weekday' token. You run every Sunday and use a date test in the command to detect the final one.

What does the date +7 days check do?

If today plus seven days has a day-of-month of 7 or less, the next Sunday is next month, so today is the last Sunday.