The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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.

ENVIRONMENT

IPCLOCKER_HOST

Hostname of lockerd server. Defaults to localhost.

IPCLOCKER_PORT

Port number of lockerd server. Defaults to 1751.

DISTRIBUTION

The latest version is available from CPAN and from http://www.veripool.com/.

Copyright 2006-2007 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 or the Perl Artistic License.

AUTHORS

Wilson Snyder <wsnyder@wsnyder.org>

SEE ALSO

IPC::Locker, pidstat, lockersh