cron question / process queue

Steven W. Orr steveo at syslang.net
Wed Mar 5 11:16:53 EST 2008


On Tuesday, Mar 4th 2008 at 12:53 -0000, quoth Kent Johnson:

=>Hi,
=>
=>I have a server that runs regular daily, weekly and monthly updates, all 
=>scheduled with cron.
=>
=>The updates are lengthy - the weekly update now takes about 8 hours - 
=>and I would like for them not to overlap. I also want them to run at 
=>night, for some reasonable value of night, so I can't just schedule them 
=>far apart.
=>
=>I can use the historical run times to schedule the jobs to prevent them 
=>overlapping, but I was wondering if there is a more robust and flexible 
=>way to do this; some way to say
=>   daily - queue the daily update
=>   weekly - queue the weekly update
=>   monthly - queue the monthly update
=>and have the updates run sequentially.
=>
=>I guess it would not be hard to write a Python program to do determine 
=>which updates to run and start the correct processes, but I'm wondering 
=>if there is some system facility that would help.

This is a classic question: How to run something on a periodic basis that 
may take longer to execute than the interval between the next occurance. 
Think of it not as a task that needs to be run at an interval so much as a 
task that needs to be rescheduled after it finally completes.

If that description is appropriate for what you're doing then you might 
want to consider not using cron in the first place. Look at using at(1) 
instead. Your script that gets run at a certain time would then requeue 
itself based on when it finished. BTW, the at command has some really sexy 
timespec abilities. You can say things like "TOMORROW at 4PM" or "NEXT 
Friday".

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net


More information about the gnhlug-discuss mailing list