News for hackers. Stuff that matters.
Re:Show HN: Crondom by npad on Thursday December 16, 2010 @02:12AM (#2011351)
"10 Things you can do with crondom.com that you can't do with crontab: 1. Run a job every 7 minutes"

I thought you could just do:

  */7 * * * * whatever...
Re:Show HN: Crondom by liuliu on Thursday December 16, 2010 @02:19AM (#2011368)
I don't know. It feels like with this line, the job will be run at 7, 14, 21, 28, 35, 42, 49, 56, thus, between 56 and the next 7, you will have 11 minutes interval. Not that familiar with crontab, I may be wrong here.
Re:Show HN: Crondom by SriniK on Thursday December 16, 2010 @03:24AM (#2011465)
I am ignorant on specific time requirements on running crontabs but I always do either 6min or 10min or something which is divisible.

Are there any specific app requirements in running 7min or 17sec?

Re:Show HN: Crondom by dfox on Thursday December 16, 2010 @06:52AM (#2011738)
Another problem with 17 seconds is that normal cron has resolution of one minute :)
Re:Show HN: Crondom by mike-cardwell on Thursday December 16, 2010 @07:20AM (#2011784)
screen -dmS 17secondjob perl -e 'while(1){`run the command`;sleep 17}'
Re:Show HN: Crondom by moeffju on Thursday December 16, 2010 @09:33AM (#2012119)
Or, simpler, use watch:

watch -n 17 -p command

Make a wrapper to run command in the background (&) if the process runtime is greater than your interval.

Re:Show HN: Crondom by xyzzyz on Thursday December 16, 2010 @08:13AM (#2011877)
This will not run the `command` in 17 seconds intervals. You need to take into account the amount of time that it takes to run it.
Re:Show HN: Crondom by mike-cardwell on Thursday December 16, 2010 @08:15AM (#2011886)
Ok. Whilst we're being anal:

screen -dmS 17secondjob perl -Mthreads -e 'while(1){threads->create(sub{`run the command`})->detach();sleep 17}'

Re:Show HN: Crondom by eru on Thursday December 16, 2010 @09:14AM (#2012056)
Or just use watch.
Re:Show HN: Crondom by mike-cardwell on Thursday December 16, 2010 @09:48AM (#2012174)
Cool. I was unfamiliar with this command. Looks useful.
Re:Show HN: Crondom by eru on Thursday December 16, 2010 @10:52AM (#2012394)
Look for `watch -p'.
Re:Show HN: Crondom by jackowayed on Thursday December 16, 2010 @02:29AM (#2011384)
Correct
Re:Show HN: Crondom by yycom on Thursday December 16, 2010 @02:51AM (#2011410)
How else would you divide 60 by 7?
Re:Show HN: Crondom by chriskelley on Thursday December 16, 2010 @02:56AM (#2011420)
I 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.
Re:Show HN: Crondom by mike-cardwell on Thursday December 16, 2010 @05:43AM (#2011657)
If it's that important that a job runs at exactly 7 minute intervals, you don't want to be relying on a remote service.
Re:Show HN: Crondom by derefr on Thursday December 16, 2010 @02:56AM (#2011419)
You don't. You divide 60*7 by 7.
Re:Show HN: Crondom by bmelton on Thursday December 16, 2010 @07:47AM (#2011830)
You want me to run it every hour?
Re:Show HN: Crondom by mike-cardwell on Thursday December 16, 2010 @09:56AM (#2012193)
You 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

Re:Show HN: Crondom by omh on Thursday December 16, 2010 @09:52AM (#2012185)
Well, 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.
Re:Show HN: Crondom by mathgladiator on Thursday December 16, 2010 @10:26AM (#2012297)
I 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.
Re:Show HN: Crondom by lhnn on Thursday December 16, 2010 @02:13AM (#2011356)
*/7, but ya.

That is a Linuxism. I found out the hard way setting up some Solaris 9 scripts last summer.

Re:Show HN: Crondom by there on Thursday December 16, 2010 @10:30AM (#2012315)
it's a vixie cron'ism. vixie cron is in all the bsds, linuxes, and mac os.
Re:Show HN: Crondom by tzs on Thursday December 16, 2010 @04:43AM (#2011584)
It is in OS X cron too.