Creating a cron job that will run every 2 days

October 19, 2010 1:29 pm
Published by
3 Comments

When creating cron jobs using cPanel there are some handy ‘common settings’ which include presets to run cron jobs from every 5 minutes to once a year. However for a lot of the scripts that I run on cron the jump from once a day to once a week, which are both defined under the common settings, is just a little bit too much of a time difference. Instead there are quite a few jobs I schedule to run once every 48 hours, however the crontab command for this is not immediately obvious and is not included in cPanel’s common settings. To run a cron job every 48 hours (i.e. every two days) try the following command:
Minute Hour Day Month Weekday
0 0 */2 * *

Categorised in:

This post was written by WillyNilly

3 Comments

  • Dernalis says:

    Sorry, but wrong. It will run the command odd days of the month.
    31 day months will make the script be ran after 3 days:
    30 -> run
    31 -> not run
    1 -> not run
    2 -> run

    You shuld try:
    0 0/48 * * * command

  • Dernalis says:

    I also were wrong =)

    30 -> not run
    31 -> run
    1 -> run
    2 -> not run

    anyway, not working.

Leave a Reply

Your email address will not be published. Required fields are marked *