NAME

lockexec - lockfile management and control.


SYNOPSIS

lockexec [--share] [--nowait] file.lock cmd [arg]...


DESCRIPTION

The normal lock file mechanism available at the shell level in unix is the 'lockfile' command. It works by checking existence of a series of files to control locking operations. There are instances where this simple scheme fails :

lockexec was built to resolve these issues. It is allows the creation of both shared and exclusive locks. And since it depends on the fcntl state of of file, and not the files existance, if can't be thrown by tasks that terminate without removing the lockfiles.


EXAMPLE

A large sql query is broken into three parallel selects, each into different temporary tables, followed by a join on the three temporary tables.

    lockexec -share sql.lock sql 'select into temp1 ....' &
    lockexec -share sql.lock sql 'select into temp2 ....' & 
    lockexec -share sql.lock sql 'select into temp3 ....' &
    lockexec        sql.lock sql 'select into target ...' 


SEE ALSO

lockfile, fcntl


BUGS

Possibly NFS safe. Only ever been tested and compiled on Linux.


AUTHOR

PaulMatthews@yahoo.com