ublock

NAME

ublock – lock a region in a shell script

SYNOPSIS

ublock -[bu] <filename>

DESCRIPTION

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.

FLAGS

FLAG ARGUMENT TYPE DESCRIPTION
-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.

ERRORS

EXAMPLE

pid=`ublock update`
... process things exclusively ...
kill $pid
... other processes can work ...

SEE ALSO

Leave a Reply