|more useful options|
Does the lock file exist? If so, someone else is already doing a cleanup.
This seems like a good solution for making sure I'm the only agent running...
Wow .. 33%. That's pretty high. After three accesses, the odds are even that you will have run the cleanup. Your choice ..
Let me clarify -- that was just a number I quickly threw out there, but basically I was thinking that there should be a 33% chance that the script will check to see if it needs to run a cleanup process. Which is something like:
Although now I'm going to have to leave another little file lying around letting my script know when the last cleanup happened. . . starting to seem pretty hacky. Maybe I should just use a scheduler :)
FYI -- I'm building this web application on trusted servers, but have no idea where it's going to be run once I'm done, which is why I'm trying to keep away from relying on cron, and relying on sysadmins to set things like that up properly.
also -- the cleanup is actually going to be doing post-due transactions from a DB.