I have a maintenance script in PHP that updates and repairs the database. In theory, running two scripts simultaneously shouldn't be a problem, but I want to be extra safe by putting a lock in a variable in PHP. The problem, of course, is that I can't store it in a $_SESSION
variable because sessions only apply to one user.
Is there any way I can store this lock in a variable? I'd prefer to not create and delete a file in case the server dies in the middle of the script.