how to set cronjob for 2 days? [closed]

From here:

Cron also supports ‘step’ values.

A value of */2 in the dom field would
mean the command runs every two days
and likewise, */5 in the hours field
would mean the command runs every 5
hours. e.g.

* 12 10-16/2 * * root backup.sh

is the same as:

* 12 10,12,14,16 * * root backup.sh

So I think you want 0 0 */2 * *.

What you’ve got (0 0 2 * *) will run the command on the 2nd of the month at midnight, every month.

p.s. You seem to have an extra asterisk in your answer. The format should be:

minute hour dom month dow user cmd

So your extra asterisk would be in the user field. Is that intended?

Leave a Comment