<?php
// test for lock file if ( !$f = fopen( 'lock', 'r')) { // touch the lock file $f = fopen( 'lock', 'w'); fwrite( $f, 'lock'); fclose( $f);
} else { // lock file exists; another instance must be running (we hope) echo 'Error: An instance of this script is already running!'; exit( 1);
}
/* script stuff */
// remove the lock file for the next instance unlink( 'lock');
?>
Shaun wrote:
Hi,
I have a script that inserts data from files uploaded to our server. I need to make sure that only one instance of this script runs at anyone time, can anyone tell me how I can do this?
Many thanks
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php