Cron: First Sunday of the Month
There is no direct cron field for "first Sunday", because day-of-month and day-of-week are ORed, not ANDed. The reliable pattern is to fire every Sunday but guard the command with a date test that only passes on days 1–7.
The expression
0 9 1-7 * * [ "$(date +\%u)" = 7 ] && /opt/app/job.sh
1-7 limits to the first week; the date +%u test (7 = Sunday) ensures it only runs on that week's Sunday. Escape % as \%.
Why you can't just use SUN
Writing 0 9 1-7 * 7 does not work: when both day-of-month and day-of-week are restricted, cron runs if either matches, so it would fire on all of days 1–7 and every Sunday.
First weekday variants
Swap the test number for other days: 1=Monday … 7=Sunday. For the first Monday, use = 1.
FAQ
What is the cron expression for the first Sunday of the month?
0 9 1-7 * * [ "$(date +\%u)" = 7 ] && /opt/app/job.sh — fire in the first week and test for Sunday (7).
Why can't I use 0 9 1-7 * 7 for the first Sunday?
Cron ORs day-of-month and day-of-week when both are set, so it would run on all of days 1–7 and every Sunday, not just the first Sunday.
How do I change it to the first Monday?
Use the same pattern with the weekday test = 1 instead of 7, since date +%u returns 1 for Monday.