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
If you create a lock file (perhaps in /var/lock), with the program's
file name, ending in .lck, you can check for that at the beginning of the
perl script and exit immediately if that file exists. At the end of the
perl script delete the file.
You can still have a race condition if two
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
. Kirkpatrick [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 28, 2000 9: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
That is an extremely easy way of doing it. I am kicking myself in the ass for
not thinking of it myself...
Thanks.
Bug Hunter wrote:
If you create a lock file (perhaps in /var/lock), with the program's
file name, ending in .lck, you can check for that at the beginning of the
perl script
One minor problem with doing it that way...
If I double click on the submit button, it works. The second process is
terminated immediately. However, the original process goes into defunct status
and exits after it is done processing the databases. It never makes it to the
exit routine that
Well, your button is the one that starts the script. If you have access
to the code in the button, the button code can write the .lck file and
then decide to spawn the perl script, or ignore the click, then the perl
script can delete the .lck file, if the perl script is being
run in a
Maybe I forgot to mention that this is all done through a web interface. The perl
script that is being ran is executed from a private web page. I am playing with using
"top" to gather a list of processes, but it takes it 1-2 second to get past that part
of the code. Do you know of a quicker
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
On Tue, 28 Mar 2000, you wrote:
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
ps ax | grep process name
is a good replacement for top for just getting data about processes.
On Tue, 28 Mar 2000, Michael D. Kirkpatrick wrote:
Maybe I forgot to mention that this is all done through a web interface. The perl
script that is being ran is executed from a private web
Instead of top, try using "ps". See the manpage of ps for more info on which
command-line options you want to have, but "ps aux" should do the trick...
On Mar 28 [EMAIL PROTECTED] wrote:
Maybe I forgot to mention that this is all done through a web interface. The perl
script that is being
Something must be wrong with the script then. Perhaps, if it's not some
top-secret stuff, you might paste the script into a mail to this list, so some
perl gurus here can take a look at it?
On Mar 28 [EMAIL PROTECTED] wrote:
One minor problem with doing it that way...
If I double click on
On Tue, Mar 28, 2000 at 02:29:26PM -0600, Michael D. Kirkpatrick wrote:
- Maybe I forgot to mention that this is all done through a web interface. The perl
- script that is being ran is executed from a private web page. I am playing with
using
- "top" to gather a list of processes, but it
14 matches
Mail list logo