Cron – Running cron every 10 minutes

cron

I have a python script on my desktop: /home/ceasor/Desktop/script.py

In /etc/crontab, I wrote:

0 */2   * * *   ceasor    sudo python  /home/ceasor/Desktop/script.py

The python script is not getting run. How do I run cron every 10 minutes?

Best Answer

Your line means runs at 0 minutes every two hours (ie 00:00, 02:00, 04:00, etc).

If you want to run something every 10 minutes :

*/10 * * * *  ceasor    sudo python  /home/ceasor/Desktop/script.py

I took the liberty to correct the wrong path.

FYI, these are the meaning of the values :

         field          allowed values
          -----          --------------
          minute         0-59
          hour           0-23
          day of month   1-31
          month          1-12 (or names, see below)
          day of week    0-7 (0 or 7 is Sun, or use names)
          username       any user from the system
          command        the command you want to run

And if you want to run something as root, you should put root instead of ceasor for the username and drop the sudo.