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 exec the process list and parse through the output, but is
> there and easier, faster, cooler, sexier, better way?  :o)
> 
> JM
> 

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 :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to