Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers 2

Can you split it in two lines? Something like:

0-59 10-15 x x x x
0-25 16 x x x x
share|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
add comment

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.

share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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