Re: [PHP] How to determine if a script instance is already running?

2005-08-04 Thread Matthew Weier O'Phinney
* Matt [EMAIL PROTECTED] : Perhaps svscan and its associated daemontools programs could be used to monitor the script instead of relying on cron. Just a note: The above suggestion would assume you control the box, and that you're running on a *nix system (i.e., you've got root on a linux, bsd,

[PHP] How to determine if a script instance is already running?

2005-08-02 Thread Jim Moseby
I have a command line script that needs to run continuously, and so I plan to have cron execute it every so often. I want to have the script first check to see if another instance is already running and, if so, die(). Now, I know I can exec the process list and parse through the output, but is

Re: [PHP] How to determine if a script instance is already running?

2005-08-02 Thread André Medeiros
On Tue, 2005-08-02 at 09:49 -0400, Jim Moseby wrote: I have a command line script that needs to run continuously, and so I plan to have cron execute it every so often. I want to have the script first check to see if another instance is already running and, if so, die(). Now, I know I can

Re: [PHP] How to determine if a script instance is already running?

2005-08-02 Thread Stut
André Medeiros wrote: Do like some services do: 1) Check if script.pid exists 2) If it doesn't 2.1) Write the process's PID onto the file (http://pt.php.net/manual/en/function.getmypid.php) 3) If it does 3.1) Die gracefully :) Personally I'd extend that slightly to have the process touch the

Re: [PHP] How to determine if a script instance is already running?

2005-08-02 Thread André Medeiros
On Tue, 2005-08-02 at 15:09 +0100, Stut wrote: André Medeiros wrote: Do like some services do: 1) Check if script.pid exists 2) If it doesn't 2.1) Write the process's PID onto the file (http://pt.php.net/manual/en/function.getmypid.php) 3) If it does 3.1) Die gracefully :)

Re: [PHP] How to determine if a script instance is already running?

2005-08-02 Thread Matt
Perhaps svscan and its associated daemontools programs could be used to monitor the script instead of relying on cron. http://cr.yp.to/daemontools.html On 8/2/05, André Medeiros [EMAIL PROTECTED] wrote: On Tue, 2005-08-02 at 15:09 +0100, Stut wrote: André Medeiros wrote: Do like some