Re: multiple job instances with cron (was: New virtual package: cron-daemon)
- To: debian-devel@lists.debian.org
- Subject: Re: multiple job instances with cron (was: New virtual package: cron-daemon)
- From: Matthias Urlichs <smurf@smurf.noris.de>
- Date: Fri, 30 Jul 2004 12:27:18 +0200
- Message-id: <[🔎] pan.2004.07.30.10.27.18.398994@smurf.noris.de>
- References: <20040601113316.GA32254@mentat.prochowa> <20040601124317.GA4545@rns-nis.co.yu> <20040601161628.GA6591@moregruel.net> <20040602133810.GA10635@mentat.prochowa> <20040602144407.GA11152@moregruel.net> <20040606110349.GA26914@mentat.prochowa> <20040606133349.GA17450@lina.inka.de> <20040606171303.GA12173@moregruel.net>
Hi, Steve Greenland wrote:
> On 06-Jun-04, 08:33 (CDT), Bernd Eckenfels <lists@lina.inka.de> 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,
you can
- 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. ;-)
--
Matthias Urlichs
Reply to: