Lock your script (against parallel run) - Eh I'm working on a script involving locks ATM. Hopefully I'll have time to fix these up a bit.

view full story

http://wiki.bash-hackers.org – Why lock? Sometimes there's the need to ensure that a script is only executed one time. Imagine some cronjob to do something very important, which will fail or corrupt data if it accidently runs twice. In these cases, a form of MUTEX (mutual exclusion) is needed. (HowTos)