Re: multiple job instances with cron (was: New virtual package: cron-daemon)
Hi, Steve Greenland wrote:
> On 06-Jun-04, 08:33 (CDT), Bernd Eckenfels <email@example.com> wrote:
>> In respect to that, does anybody know, why the default behaviour of crons is
>> to start multiple instances of the same job, if the execution times overlap.
>> Is this intentional or only because it makes book keeping simpler?
> Mostly bookkeeping. "Intentional" in the sense that code is not
> structured in a way that would allow easy retrofitting of such a
> feature, i.e. there was no consideration of such a feature when the code
> was written.
Well, I wrote such a patch five years ago. It's quite simple to do a
quick 90% solution (i.e. one where processes will be ignored if they
happend to be running while you reload).
The 100% solution would require giving the jobs unique IDs, and thus a
change in file formats. *Sigh*.
Anyway, if you want five-minute intervals between ten-minute cron jobs,
- tell your daemon to create+check a pid file
- use shlock or a similar shell helper (part of INN. Available separately.)
to manage a pid file
- use a shell script
while sleep 300 ; do JOB; done
- use a cron-like program which can do it
- write your daemon in such a way that multiple executions won't hurt
- do more than one of the above at the same time
- just run the thing every fifteen minutes and deal with the fallout if it
happens to run longer than that
- probably somthing else I've missed.
So there. ;-)