ublock – lock a region in a shell script
ublock -[bu] <filename>
ublock is a shell locking function. This is used to restrict access to sections of shell scripts to one user at a time. It uses the semaphore features of Unix and creates a file called name.sem to control access.
ublock prints a process id on stdout. To unlock a section when processing is complete, the process should be killed.
|-b||pid of the lock process is written to stdout in native binary format. Some processes can read this directly and speed up the interlocking.|
|-u||Remove the semaphore file created for locking. This effectively unlocks a function.|
pid=`ublock update` ... process things exclusively ... kill $pid ... other processes can work ...