[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Edlug Archive Mar 2004 ]

Re: [edlug] Perl - Only run n instances of script?










Instead of writing a single lock file, you could write to 4. If 
all 4 exist, then lock them out. 

Or write the pids to a single file, and remove them when the 
script ends. Lock them out if there are 4 pids. 

 

d.

On 11 Mar 2004 at 10:32, Lee Kindness wrote:

> 
> Anyone got a quick way of limiting/locking a script so that it can
> only be run, for example, 4 times concurrently? Any other runs of the
> script would block until a "slot" was available.
> 
> Obviously if "n" was 1 then I could use flock(). I know I can use
> SysV::Semaphore, but I'm sure there's something nicer! I really don't
> want to have to work my way through that horrid syntax again...
> 
> Thanks, L.
> -
> ----------------------------------------------------------------------
> You can find the EdLUG mailing list FAQ list at:
> http://www.edlug.org.uk/list_faq.html



-- 
Dr. David R. Baird
ZeroFive Web Design
dave@xxx.xxx.xxx
http://www.zerofive.co.uk
-
----------------------------------------------------------------------
You can find the EdLUG mailing list FAQ list at:
http://www.edlug.org.uk/list_faq.html



This archive is kept by wibble@morpheux.org.DONTSPAMME
homepage