Wanting to hone my shell scripting skills a bit, I ended up reimplementing a cute script by Dustin Kirkland.
run-one is basically a thin wrapper around
lockf(1), or on Linux
-% lockf /var/tmp/sleep-5.lock sleep 5 # <runs sleep 5 under the named lock> -% run-one sleep 5 # <runs sleep 5 under a lock named by a SHA256 of its arguments>
It also has some handy features like:
-% run-this-one sleep 30 & -% run-this-one sleep 30 # kill the original  - exit 70 run-this-one sleep 30
While conceptually simple, there are some fiddly details I felt the original got wrong. Not least, it didn't run under FreeBSD.
So, mine was born. I feel a bit cheeky giving it the same name, but I've done my best to reference the original frequently to limit confusion.