Keith Devens .com |
Tuesday, March 16, 2010 | ![]() |
| ... be conservative in what you do, be liberal in what you accept from others. – Jon Postel (RFC 793) | ||
|
| ← Caching | Amy Acker is awesome → |

Drew Csillag (http://idiotic.blogspot.com) wrote:
Ryan (http://www.trolocsis.com) wrote:
From the man pages, it appears the minute's maximum value in the cron is 59 minutes. Perhaps something like this will work:
30 0,2,4,6,8,10,12,14,16,18,20,22 * * * yourscript
0 1,3,5,7,9,11,13,15,17,19,21,23 * * * yourscript
or maybe 1-23/2 for the hour field
foobar wrote:
The above posters are incorrect, as the syntax will direct cron to run your job in alternating periods of 90 and 30 minutes. Here's the correct syntax for cron (assuming your first job is scheduled to run at midnight):
0 0,3,6,9,12,15,18,21 * * * <commands>
30 1,4,7,10,13,16,19,22 * * * <commands>
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):
Generated in about 0.154s.
(Used 8 db queries)
Well, for 90 minutes, it'd be
0 0,2,4,6,8,10,12,14,16,18,20,22 * * * blahblahblah
30 1,3,5,7,9,11,13,15,17,19,21,23 * * * blahblahblah
For 72 minutes..... mwahahahahaha! ROTFL.... Oh... you were serious?
Alternatively, if the exact timing isn't absolutely required (i.e. if its' 73 or 71 minutes) you could use "recursive" at jobs.
For example:
in file x.at:
....cut here....
python << EOF > nexttime
import time
t = time.localtime(time.time() + (72*60))
print "%02d:%02d" % (t[3], t[4])
EOF
at -f x.at cat nexttime
rm nexttime
periodic_task_program
....cut here....
Then run "at -f x.at now" and that should run the task immediately, and then every 72 minutes. This has, of course, only been cursorararily (if that's a word) tested, so YMMV. It is possible that if your periodic task takes longer than 72 minutes, weird things can happen, but I suspect that if your periodic task takes 72 minutes, weird things have already happened.
The python script could of course be replaced by any better date computing thing you wish.
Drew