2

I want to set up a job to run every 15 minutes, starting at the 5th minute.

This is my crontab line:

5/15 * * * * /root/job.sh >> /root/job.log

But it only runs once an hour, on the fifth minute. I confirmed by checking /var/log/syslog.

On Debian 7.8.

3

Have you looked at this?

I think what you are looking for is:

5-59/15 * * * * /root/job.sh >> /root/job.log
  • 1
    I like your Stackoverflow link – roaima Feb 20 '15 at 23:06
  • Thanks, that's a great link. I'd looked for a similar scenario but I guess I didn't think of the right keywords in order to find that discussion. Obviously the part I missed is that I actually needed to specify a range for the stepping to work. Thank you. – Saul Feb 23 '15 at 17:46
1

What you've written in your crontab entry doesn't match your stated need. The manpage (man 5 crontab) is reasonably clear on this:

Step values can be used in conjunction with ranges. Following a range with "/" specifies skips of the number's value through the range. For example, "0-23/2" can be used in the hours field to specify command execution every other hour [...]

To run every 15 minutes starting at 5 minutes past the hour, I'd go for the simple 5,20,35,50. A step value such as 5/3 should also work, but in this instance I'd suggest that its intent is less obvious.

  • Thanks for replying -- I had ended up with a simple list but was hoping for a more elegant solution. BTW, after realizing that a range is required for the step to work, it looks to me like 5/3 wouldn't work either. – Saul Feb 23 '15 at 17:48

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.