Cron job every three days

Is it possible to run a cronjob every three days? Or maybe 10 times/month.


Solution 1:

Run it every three days...

0 0 */3 * *

How about that?

If you want it to run on specific days of the month, like the 1st, 4th, 7th, etc... then you can just have a conditional in your script that checks for the current day of the month.

if (((date('j') - 1) % 3))
   exit();

or, as @mario points out, you can use date('k') to get the day of the year instead of doing it based on the day of the month.

Solution 2:

* * */3 * *  that says, every minute of every hour on every three days. 

0 0 */3 * *  says at 00:00 (midnight) every three days.