solo is a very simple script (10 lines) that prevents a program from running more than one copy at a time. It is useful with cron to make sure that a job doesn’t run before a previous one has finished.
* * * * * solo -port=3801 /usr/local/bin/awesome-script.sh blah blah
The clever part is the use of binding to TCP ports to ensure that only one copy of the script is running at a time. No more lockfiles or filesystem tricks, just let the kernel figure out if the port is already in use.