This is my first post that is not dedicated to vim trickery. I have expanded the scope of my blog to include SysAdmin and EC2 related topics. I hope you like them.
I can’t believe it took me so long to need a cronjob that ran every 90 minutes. When it finally happened (last night at 1:30 am) I realized that I had never even thought about this before. How do you set a job to run in odd increments like this?
My first choice would be */90, but that of course would be too easy. This results in the job being accepted, but run once an hour (in vixie-cron.) IMHO it should throw an error alerting you to the fact that you have asked it to do something it is not capable of, instead it happily accepts the job and you have no idea that it is not going to work the way you are expecting. Kinda LAME, if not dangerous.
There are two ways that I have found to do this. More correctly, one way with two variations.
First the long way:
0 0,3,6,9,12,15,18,21 * * * job_a
30 1,4,7,10,13,16,19,22 * * * job_a
The shorter way:
0 0-21/3 * * * job_a
30 1-22/3 * * * job_a
Both seem to work fine. What if you need 92 minutes though? Maybe that’ll be in another post.




Recent Comments