Re: Only one instance of a script at a time !

From: Date: Fri, 28 Dec 2001 15:02:08 +0000
Subject: Re: Only one instance of a script at a time !
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-78944@lists.php.net to get a copy of this message
I was thinking about this solution, but what can I do if the script ends prematurely. The file will never be deleted ?? Anybody has an example of how to use flock ? Nicolas "Gerard Onorato" <gonorato@desktoplive.com> a écrit dans le message news: php.general-78939@news.php.net... > 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 > > > > > > >

« previous php.general (#78944) next »