4 ms·
How else would you divide 60 by 7?
by yycom 16y ago
How else would you divide 60 by 7?
- derefr 16y agoYou don't. You divide 60*7 by 7.
- bmelton 16y agoYou want me to run it every hour?
- omh 16y agoWell, you could put multiple cron lines in. e.g. for every 8 minutes: 0,8,16,24,32,40,48,56 0,2,4,6,8,10,12,14,16,18,20,22 * * * cmd 4,12,20,28,36,44,52 1,3,5,7,9,11,13,15,17,19,21,23 * * * cmd This starts to get a bit silly when the interval isn't a factor of 24 though.
- mathgladiator 16y agoI wrote a simple script to generate cron tab specs for "every X minute", and while I enjoyed using gcd and lcm in a real application; something wasn't right. 7 is a very canonical and crazy case because it takes 7 days to cycle. but even then, it doesn't work with months except for February for non leap years.
- mike-cardwell 16y agoYou misunderstand what he's saying. Because 60 doesn't divide into 7, don't use one 60 minute cron job. Use 7 cron jobs. You could get this magical 7 minute experience over a 24 hour period by creating the following 7 jobs: 0-56/7 0-21/7 * * * Command 3-59/7 1-22/7 * * * Command 6-55/7 2-23/7 * * * Command 2-58/7 3-17/7 * * * Command 5-54/7 4-18/7 * * * Command 1-57/7 5-19/7 * * * Command 4-53/7 6-20/7 * * * Command Of course, the last job would finish at 23:55, and the next start at 00:00 which is bad. So you'd need to do it on a per day basis. Luckily there are 7 days in the week. So you would just need to write those 7 jobs above on a per day basis. You'd end up with 49 jobs all looking similar to this: 0-56/7 0-21/7 * * Wed Command
- chriskelley 16y agoI think the idea is that instead of: 7, 14, 21, 28, 35, 42, 49, 56,(11 min gap), 7, 14, etc Crondom would run: 7, 14, 21, 28, 35, 42, 49, 56, 3, 10, 17, 24, ..., n+7 OP correct me if I'm wrong with the intention of that bullet point.
- mike-cardwell 16y agoIf it's that important that a job runs at exactly 7 minute intervals, you don't want to be relying on a remote service.