On Thursday 05 August 2004 05:34, Carlos E. R. wrote: Yup. Typical sysadmin approach, I think. ;) And you got that right about the "I feel lazy" part. :D
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