http://uk2.php.net/manual/en/function.flock.php :- <?php if ($fp = fopen("/tmp/lock.txt", "w")) } else { echo "File is probably locked"; do something; } if (flock($fp, LOCK_EX)) { // do an exclusive lock } else { echo "Couldn't get the lock!"; } do something; fclose($fp); ?> -----Original Message----- From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx] On Behalf Of BlueTulip Sent: 12 August 2009 16:36 To: php-objects@xxxxxxxxxxxxxxx Subject: Re: PHP Help how to make LOCK.FILE On Wed, Aug 12, 2009 at 17:32, Atkinson, Robert <ratkinson@xxxxxxxxxxxxx>wrote: > > > If the script stops, i.e. the server process dies, then the file lock will > release. If the script completes, then you need to free the file at the > end. > > Problem? > > -----Original Message----- > From: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com> [mailto: > php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com>] On > Behalf Of BlueTulip > Sent: 12 August 2009 15:50 > To: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com> > Subject: Re: PHP Help > > ok,but i have problem with this solution > > sometimes the script is stop or disconnect to any reason > > and with your solution i have locked file at all time and the file will not > run another time > > On Wed, Aug 12, 2009 at 16:40, Atkinson, Robert > <ratkinson@xxxxxxxxxxxxx <ratkinson%40tbs-ltd.co.uk>>wrote: > > > > > > > Not exactly what you asked. > > > > Either create LOCK.FILE, then have name.php lock the file whilst it's > > running. You can then also test to see if the file is locked. > > > > If it's a question of only running every x minutes, then put a 'last run' > > timestamp in the file and check that in name.php. > > > > If you can use MySQL, you could do the same in a table instead. > > > > Rob. > > > > -----Original Message----- > > From: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com><php-objects% > 40yahoogroups.com> [mailto: > > php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com><php-objects% > 40yahoogroups.com>] On > > Behalf Of BlueTulip > > Sent: 12 August 2009 15:36 > > To: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com><php-objects% > 40yahoogroups.com> > > Subject: Re: PHP Help > > > > Thanks, > > > > But i want to run " name.php " on server every " x " minutes > > > > and i want to not run twice in the same time > > > > Ogden Nash <http://www.brainyquote.com/quotes/authors/o/ogden_nash.html> > - > > "The trouble with a kitten is that when it grows up, it's always a cat." > > > > On Wed, Aug 12, 2009 at 16:26, Atkinson, Robert > > <ratkinson@xxxxxxxxxxxxx <ratkinson%40tbs-ltd.co.uk> <ratkinson% > 40tbs-ltd.co.uk>>wrote: > > > > > > > > > > > > > > Index.php :- > > > <?php > > > $name_run = "false"; > > > .... > > > > > > If ($name_run) { > > > do something; > > > } > > > ?> > > > > > > Name.php :- > > > <?php > > > $name_run = "true"; > > > ?> > > > > > > > > > -----Original Message----- > > > From: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com> > <php-objects%40yahoogroups.com><php-objects% > > 40yahoogroups.com> [mailto: > > > php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com><php-objects% > 40yahoogroups.com><php-objects% > > 40yahoogroups.com>] On > > > Behalf Of BlueTulip > > > Sent: 12 August 2009 14:41 > > > To: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com> > <php-objects%40yahoogroups.com><php-objects% > > 40yahoogroups.com> > > > Subject: PHP Help > > > > > > Hello > > > > > > Can i check if "name.php" is run now or not with php > > > > > > Thanks > > > > > > [Non-text portions of this message have been removed] > > > > > > ------------------------------------ > > > > > > Are you looking for a PHP job? > > > Join the PHP Professionals directory Now! > > > http://www.phpclasses.org/jobs/ > > > Yahoo! Groups Links > > > > > > > > > > > > > > > ***************************************************************************** > > ****** > > > Any opinions expressed in email are those of the individual and not > > > necessarily those of the company. This email and any files transmitted > > with > > > it are confidential and solely for the use of the intended recipient or > > > entity to whom they are addressed. It may contain material protected by > > > attorney-client privilege. If you are not the intended recipient, or a > > > person responsible for delivering to the intended recipient, be advised > > that > > > you have received this email in error and that any use is strictly > > > prohibited. > > > > > > Random House Group + 44 (0) 20 7840 8400 > > > http://www.randomhouse.co.uk > > > http://www.booksattransworld.co.uk > > > http://www.kidsatrandomhouse.co.uk > > > Generic email address - > > enquiries@xxxxxxxxxxxxxxxxx <enquiries%40randomhouse.co.uk> <enquiries% > 40randomhouse.co.uk><enquiries% > > 40randomhouse.co.uk> > > > > > > Name & Registered Office: > > > THE RANDOM HOUSE GROUP LIMITED > > > 20 VAUXHALL BRIDGE ROAD > > > LONDON > > > SW1V 2SA > > > Random House Group Ltd is registered in the United Kingdom with company > > No. > > > 00954009, VAT number 102838980 > > > > > > > > > > > > ***************************************************************************** > > ****** > > > > > > > > > > > > > [Non-text portions of this message have been removed] > > > > ------------------------------------ > > > > Are you looking for a PHP job? > > Join the PHP Professionals directory Now! > > http://www.phpclasses.org/jobs/ > > Yahoo! Groups Links > > > > > > > > [Non-text portions of this message have been removed] > > ------------------------------------ > > Are you looking for a PHP job? > Join the PHP Professionals directory Now! > http://www.phpclasses.org/jobs/ > Yahoo! Groups Links > > > [Non-text portions of this message have been removed] ------------------------------------ Are you looking for a PHP job? Join the PHP Professionals directory Now! http://www.phpclasses.org/jobs/ Yahoo! Groups Links