RE: [PHP] Ensure only one instance of a script is running

From: Date: Wed, 16 Mar 2005 16:12:00 +0000
Subject: RE: [PHP] Ensure only one instance of a script is running
Groups: php.general 
Request: Send a blank email to php-general+get-210901@lists.php.net to get a copy of this message
[snip] 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? [/snip] Don't run another instance. ba-dump ching! Ok, here is a quick and dirty way to do it, have the script check for the existence of a file containing a date and timestamp, if one does not exist the script creates one. If it does exist, the script exits. Once the script is nearing completion have it destroy the file (unlink).

« previous php.general (#210901) next »