[expert] Multiple Processes

2000-03-28 Thread Michael D. Kirkpatrick
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

Re: [expert] Multiple Processes

2000-03-28 Thread Bug Hunter
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

RE: [expert] Multiple Processes

2000-03-28 Thread Ken Wilson
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

RE: [expert] Multiple Processes

2000-03-28 Thread Fred Frigerio
. 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

Re: [expert] Multiple Processes

2000-03-28 Thread Michael D. Kirkpatrick
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

Re: [expert] Multiple Processes

2000-03-28 Thread Michael D. Kirkpatrick
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

Re: [expert] Multiple Processes

2000-03-28 Thread Bug Hunter
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

Re: [expert] Multiple Processes

2000-03-28 Thread Michael D. Kirkpatrick
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

Re: [expert] Multiple Processes

2000-03-28 Thread Rial Juan
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

Re: [expert] Multiple Processes

2000-03-28 Thread John Aldrich
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

Re: [expert] Multiple Processes

2000-03-28 Thread Bug Hunter
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

Re: [expert] Multiple Processes

2000-03-28 Thread Rial Juan
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

Re: [expert] Multiple Processes

2000-03-28 Thread Rial Juan
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

Re: [expert] Multiple Processes

2000-03-28 Thread Charles Curley
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