Re: Only one instance of a script at a time !
| From: | Gerard Onorato | Date: | Fri, 28 Dec 2001 14:47:58 +0000 |
| Subject: | Re: Only one instance of a script at a time ! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78939@lists.php.net to get a copy of this message | ||
There may be a much easier method however why not write a file and then check for it's
existence on the next execution. Delete the file at the end of
execution to clear the way for the next pass.
Quick and dirty so probably at least on typo
<?
$pidFile = "path/to/file/filename";
if (!is_file ($pidFile)) {
touch ($pidFile);
// code to execute
unlink ($pidFile);
}
?>
On Fri, 28 Dec 2001 15:31:33 +0100, Nicolas Guilhot wrote:
>Running a php script with a cron job, how can I do to have only one instance
>of the script running ?
>
>Thanks for any answer.
>
>
>Nicolas
>
>
>--
>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
>
>