tags:

views:

131

answers:

3

Hi, I am using crontab command for db backup purpose,and want to take a backup once every two days. is this correct 0 0 2 * * *

if wrong please tell me the correct command for setting cron for 2 days..pls help..

A: 

Try CronWTF to find out.

Luke Francl
+3  A: 

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?

Dominic Rodger
A: 

If you wanna use crontab -e command, try this time pattern: 0 1 */2 * * command_to_execute

Or, you can try SetCronJob for a web based solution. You can easily create cron jobs every 2 days with the second creating row.