How do I run a cron job once a month?

So cron is pretty amazing. Cron does have it’s limitations when you want to run a job only once a month. While you can run a job like the one below that runs at 16 hundred hours every Monday.

00 16 * * 1 /usr/bin/billing-job

What if you only want to run the job on the first Monday of the month. Say for example you need to run your billing job every first Monday of the month. Then it gets a bit more complicated. I provided a example of the code below that would accomplish this goal of running the job on only the first Monday of the month. The cron job will run every Monday but the case state will only ecute ture when the date command returns that it is less then or equal to the seventh day of the month.

00 16 * * 1 [ $(date +\%d) -le 07 ] && /usr/bin/billing-job