Ok, so I have a cron job that runs in every minute between 10:00 and 17:00 every day, every month from Monday to Friday.

My problem is that currently it runs from 10:00 - 17:00 (cron entry in hour column 10-16) and I want it to run from 10:00 to 16:25

I tried to put this in the hour column 10-16:25 but it doesn't work...

Can I set fractional hour ranges? If yes, how?

Thanks.

link|improve this question
feedback

2 Answers

Can you split it in two lines? Something like:

0-59 10-15 x x x x
0-25 16 x x x x
link|improve this answer
@chmee I think this is a good solution, though it's not possible to create it with one line? – feketegy Mar 3 '10 at 10:36
I don't know if you could do that with cron but... have you looked if you could achieve this goal with upstart? – chmeee Mar 3 '10 at 14:37
Oops, I confused upstart with launchd. Cron functionality will be added later: upstart.ubuntu.com/faq.html#replace-cron – chmeee Mar 3 '10 at 15:05
feedback

If you don't want to split the cron job as chmee suggests you could get the functionality you desire by using a scripted solution. The script, which is run from the cron job, can test the time range and run the appropriate command(s) only if the range is correct. It's a little more work but provides vastly more flexibility.

link|improve this answer
@John Gardeniers: Yes this is how works currently. My only problem is that the script is still running after 16:25 and checking the time which imho is a waste of resources – feketegy Mar 3 '10 at 10:36
A script that when started checks the time and exists if that time is outside its operational window would run so briefly and use so little of your resources that I really think it can be ignored from the waste point of view. – John Gardeniers Mar 3 '10 at 16:33
feedback

Your Answer

 
or
required, but never shown

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