Have your script make a simple empty file called 'perl.lock'. The idea
is to check for this file first. If it exists a copy of the program is
already running so have any subsequent programs exit gracefully. Oh
yeah, remember to delete the file after the original script has run.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Michael D.
Kirkpatrick
Sent: Tuesday, March 28, 2000 6:16 AM
To: [EMAIL PROTECTED]
Subject: [expert] Multiple Processes
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.