NAME

lockersh - Run a command under a global lock

SYNOPSIS

  lockersh [--dhost <host> --port <port>] --lock <name> [args....]

DESCRIPTION

Obtain a global IPC::Locker lock with the passed name.

When the lock is granted, run the arguments as a command in the foreground. When the foreground process exits, release the lock, and return the executed command's exit status.

This makes it very easy to insure only one copy of a program executes across a clump:

   lockersh --lock one_sleep_runs sleep 10

ARGUMENTS

--dhost host

Hostname of lockerd server. Defaults to IPCLOCKER_HOST environment variable.

--help

Displays this message and program version and exits.

--lock lockname

Name for the lock. This argument may be passed multiple times or with a colon separator to allow one of multiple possible locks to be selected.

--locklist

Suppress normal operation, and instead print a list of all outstanding locks and their owners.

--port port

Port of pidstatd server on remote host. Defaults IPCLOCKER_PORT environment variable.

--timeout

Set number of seconds before wait for license will timeout. Defaults to wait forever.

--verbose

Print 'waiting for lock' and similar messages.

--version

Displays program version and exits.

ENVIRONMENT

IPCLOCKER_HOST

Hostname of lockerd server, or colon separated list including backup servers. Defaults to localhost.

IPCLOCKER_PORT

Port number of lockerd server. Defaults to 1751.

DISTRIBUTION

The latest version is available from CPAN and from https://www.veripool.org/ipc-locker.

Copyright 2006-2022 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.

AUTHORS

Wilson Snyder <wsnyder@wsnyder.org>

SEE ALSO

IPC::Locker, lockerd