Re: how to avoid "spawning" multiple process of the same script ..

2006-08-12 Thread Randal L. Schwartz
> "Christer" == Christer Ekholm <[EMAIL PROTECTED]> writes: Christer> Very elegant. I like that. Unfurtunately I can't get that to work on Christer> HP-UX. A trace with tusc shows that the fcntl syscall on DATA always Christer> fails with errno=9 (EBADF) Christer> Not a big problem, the easy

Re: how to avoid "spawning" multiple process of the same script ..

2006-08-11 Thread Christer Ekholm
merlyn@stonehenge.com (Randal L. Schwartz) writes: > Use the "highlander" solution: > > #!/usr/bin/perl > > BEGIN { > use Fcntl ':flock'; > flock DATA, LOCK_EX | LOCK_NB or exit 0; # I'm already running > } > > [ rest of your script here ] > > __END__ > > To do this,

Re: how to avoid "spawning" multiple process of the same script ..

2006-07-08 Thread Ken Foskey
On Wed, 2006-07-05 at 22:50 -0700, BenBart wrote: > Hi all, > > How do I prevent multiple instance of the same script from running? > > That is for example, if I have a script named script1.pl and it is > already running, I want the script to be able to check that it is > already running and th

Re: how to avoid "spawning" multiple process of the same script ..

2006-07-07 Thread Randal L. Schwartz
> "BenBart" == BenBart <[EMAIL PROTECTED]> writes: BenBart> How do I prevent multiple instance of the same script from running? Use the "highlander" solution: #!/usr/bin/perl BEGIN { use Fcntl ':flock'; flock DATA, LOCK_EX | LOCK_NB or exit 0; # I'm already running

Re: how to avoid "spawning" multiple process of the same script ..

2006-07-05 Thread Mr. Shawn H. Corey
BenBart wrote: > Hi all, > > How do I prevent multiple instance of the same script from running? > > That is for example, if I have a script named script1.pl and it is > already running, I want the script to be able to check that it is > already running and then just exit ... > > Is this possibl

Re: how to avoid "spawning" multiple process of the same script ..

2006-07-05 Thread dzhuo
one common way of doing this sort of stuff is to have your script write a PID (process ID) file. when you start up your process, your script will check for this file, if the file is there, a copy of it is already running. if the file is missing, your script will create the PID file and continue

Re: how to avoid "spawning" multiple process of the same script ..

2006-07-05 Thread Dr.Ruud
BenBart schreef: > How do I prevent multiple instance of the same script from running? See perldoc -f flock -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: how to avoid "spawning" multiple process of the same script ..

2006-07-05 Thread Jeff Peng
That is for example, if I have a script named script1.pl and it is already running, I want the script to be able to check that it is already running and then just exit ... Do you mean you check this script's running status from extern environment?If this script is running,you could get its p

how to avoid "spawning" multiple process of the same script ..

2006-07-05 Thread BenBart
Hi all, How do I prevent multiple instance of the same script from running? That is for example, if I have a script named script1.pl and it is already running, I want the script to be able to check that it is already running and then just exit ... Is this possible to do in both UNIX and Wind