I want to run three cron jobs commands twice per hour (once every half hour) and the interval between these command should be 1-2 minutes. How should I configure cron jobs from cpanel?


I can't speak for cpanel, I'm afraid, but the crontab entries (if you can get to those) should look like this:

1,31 * * * *  /path/job1
3,33 * * * *  /path/job2
5,35 * * * *  /path/job3

That'll run each twice an hour, at 1, 3, and 5 minutes past the hour and half-hour.

  • Will the interval change from 2 to 3 minutes in this case: 1,31 * * * * /path/job1 4,33 * * * * /path/job2 7,35 * * * * /path/job3 – Levani Feb 8 '11 at 16:47
  • 1
    It'll change to three minutes for the ones that run after the hour, but not the ones that run after the half-hour. Try 1,31 / 4,34 / 7,37 for both. It's just the number of minutes past the hour that each job should run, with each job running at two different times past each hour - do you see the logic? – MadHatter supports Monica Feb 8 '11 at 17:15

The interval between starting the jobs should be 2 minutes, or the interval from after one finishes 'til the next one starts should be 2 minutes?

If it's the first case, see MadHatter's comment.

If it's the second case, it's easiest to wrap the whole thing in a shell script, and do sleep 120 in between.

I'll often do this if the next task shouldn't fire off if the previous task didn't return cleanly. It also makes it easier to set a semaphore for the whole group of tasks so if a task gets hung, the next time it runs, you don't kick off the tasks again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.