RE: [PHP] Is CRON'd PHP script already running?
| From: | Jack Dempsey | Date: | Thu, 20 Sep 2001 17:28:53 +0000 |
| Subject: | RE: [PHP] Is CRON'd PHP script already running? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-68023@lists.php.net to get a copy of this message | ||
i'm sure there are more elegant solutions, but you could control the running
of your php script via a perl script called by cron....in perl check to see
if the process is already running, and if so exit, else start it
jack
-----Original Message-----
From: Simon Kimber [mailto:simon@funny.co.uk]
Sent: Thursday, September 20, 2001 1:13 PM
To: php-general@lists.php.net
Subject: [PHP] Is CRON'd PHP script already running?
Hi All,
I have a PHP script that i want to run every few minutes (via cron) but I
only want it to run if it isn't already running.
Is there something in cron itself to solve this or is there a way within PHP
to detect that another instance of the current script is running and if so
exit the new instance before it does anything...
eg. I could have a function to use like so:
if (already_running($SCRIPT_NAME)) {
exit();
}
Thanks in advance!
Simon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net