How about the plain old lock-file trick? First thing the script does is check if
a file called 'lock' or something, exists. If not, it creates an empty file
called 'lock', and continues. When it's finished, it deletes the file. All you
have to do is make sure that you check for the files existance in the beginning
of the script, and use a simple 'if' to determine if it will continue, or die
right there and then.


On Mar 28 [EMAIL PROTECTED] wrote:

> Is there a way to mark a perl script to be ran as a single process only?
> 
> The problem:
> I have a perl script that takes 3-5 seconds to run (Very large databases)
> If I mess up and double click on the submit button, a second process is
> spawned off.  This completely slows down the first process and takes twice
> as long to process.  As for a test, I clicked the submit button 20 times
> and it spawned off 20 processes and totally slowed down the server for a
> long while.
> 
> I want the server to reject the script from running more then 1 process.
> Is this a perl thing where I have to encode in the script to check for
> other copies being ran?  Or is there an access right that can be set where
> it only allows 1 copy to be ran?
> 
> This is not a public script.  There are 5 people that access this script on
> a regular basis.
> 
> Thanks in advance.
> 

-- 

Rial Juan                        <http://nighty.ulyssis.org>
                e-mail:              [EMAIL PROTECTED]
Belgium            tel:                    (++32) 89/856533
ulyssis system admininstrator       <http://www.ulyssis.org>

The little critters in nature; they don't know they're ugly.
That's very funny... A fly marying a bumble-bee...

------------------------------------------------------------

Sign the petition at http://www.libranet.com/petition.html
Help bring us more Linux Drivers


Reply via email to