#060 File Locks
How to implement simple resource semaphores with file locks.
For when we want to ensure that only one instance of a shell script can be run at the same time.
flock / lockfile
flock utility should be available by default in most Linux distros.
It used to be in MacOSX also, but not since at least Yosemite.
lockfile should be available though. The test script will look for either.
The lock_n_load.sh script demonstrates locking with either
parsing an invented syntax from an environment variable.
$ ./lock_n_load.sh & ./lock_n_load.sh  Locked  Doing something interesting here... Mon Oct 9 23:13:27 SGT 2017  Loaded  Locked  Doing something interesting here... Mon Oct 9 23:13:35 SGT 2017  Loaded $