Why does this crontab file only run once

croncronjobcrontab

I have the following crontab file:

2 * * * * /bin/date >> /home/jon/date_from_cron.txt

I think this means "run every two minutes". However, it only runs once. Shortly after setting up this crontab file I checked /home/jon/date_from_cron.txt and found that it contained the following:

Tue Jan  8 17:02:01 CST 2013

Ten minutes later, it still contains just that one line.

What am I doing wrong?

EDIT: I've been told to use /2 at the beginning to make the job run every two minutes. But my operating system does not support this. I have tried on both a Mac running Mountain Lion and on an Ubuntu machine. Here is a quote from the internet regarding this: "Repeat pattern like /2 for every 2 minutes or /10 for every 10 minutes is not supported by all operating systems. If you try to use it and crontab complains it is probably not supported." So, given that this is not supported on my machines, how can I get a job to run every X minutes?

Best Answer

If you want the cron job to run every two minutes, it should be /2 * * * * /bin/date >> /home/jon/date_from_cron.txt

http://www.adminschoice.com/crontab-quick-reference

EDIT: Possibly try */2 * * * * /bin/date >> /home/jon/date_from_cron.txt

Related Question