Cron: Day-of-Month and Day-of-Week Together
When both the day-of-month (field 3) and day-of-week (field 5) are set to anything other than *, cron fires when EITHER one matches — it is an OR, not an AND. This is the single most common cron surprise.
The rule
0 0 13 * 5 does not mean "midnight on Friday the 13th". It means "midnight on the 13th of every month, and also every Friday". When day-of-month and day-of-week are both restricted, Vixie/standard cron treats them as OR.
Why
Historically cron allowed either a day-of-month schedule or a day-of-week schedule, so restricting both is interpreted as "match either". If one of the two fields is *, there is no ambiguity and it behaves as you expect.
How to force AND (both must match)
Leave day-of-week as * in the crontab and test the weekday inside your script:
0 0 13 * * [ "$(date +\%u)" = 5 ] && /path/to/job.sh
That runs on the 13th of every month but the shell test only lets it through on Friday — a true "Friday the 13th" job.
Quick reference
DOM=* or DOW=* → normal AND-like behaviour. Both restricted → OR. When in doubt, keep one field as * and gate the rest in code.
FAQ
Does 0 0 13 * 5 mean Friday the 13th?
No. It runs at midnight on the 13th of every month AND every Friday, because when both day-of-month and day-of-week are restricted, cron uses OR.
How do I make cron require both a day-of-month and a weekday?
Keep day-of-week as * and check the weekday inside the command, e.g. [ "$(date +%u)" = 5 ] && /path/to/job.sh.
When is the day-of-month/day-of-week rule an AND?
Whenever one of the two fields is *. The OR behaviour only kicks in when both fields are restricted.