Linux flock, how to “just” lock a file?
To lock the file: exec 3>filename # open a file handle; this part will always succeed flock -x 3 # lock the file handle; this part will block To release the lock: exec 3>&- # close the file handle You can also do it the way the flock man page describes: { flock -x 3 … Read more