See here:
RFC: A new module to help avoid running multiple instances of the same script (via cron, for example)
In reply to Re: Easiest way to protect process from duplication. by scorpio17 in thread [Solved]Easiest way to protect process from duplication. by kazak