The Wednesday 2004-08-04 at 20:29 -0500, C Hamel wrote:
On Wednesday 04 August 2004 14:00, Misty Stanley-Jones wrote:
Every 18 hours huh? 18 is a multiple of 6. 6*3 is 18, 6*4 is 24. Every 18 hours would be 6, 24, 18, 12. Run the cron job at all of these times, have it check for a file /tmp/should_run that gets generated when the script should run.
Not sure that I follow you. Would you mind elaborating? (Have you heard the story of the donkey that needed a 2x4 in the head to get its attention so it would plow?)
Simple enough. Suppose you start at 00 hours. The next time, 18 hours later, would be at 18:00. The next time at 12:00 of the next day... you have an arithmetic series: day hour lapse ---+--------+------ 0 00:00 00 0 18:00 18 1 12:00 36 2 6:00 54 2 24:00 72 So you get a three days cycle. How to put that into crontab: "I'll leave that as an exercise for the reader", translated as "I feel lazy" :-p [...] Alternatively, what the original poster said, is to have the script run every day at hours 00, 6, 12, 18 and 24 (00), but check at the start when was the last time it run, calculating the time diference. Ie, the first time it would run at 00:00 hours, and would save a flag file somewhere stating that fact. The next cron job would start at 06:00, read the flag file, notice the time lapse not being 18 hours, ant exit. Same thing at noon, but at 6 PM the time lapse would be correct, it would run, and then, modify the flag file. Right? :-) -- Cheers, Carlos Robinson