cronmutex

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2018 License: MIT Imports: 1 Imported by: 0

README

cronmutex

Build Status Go Report Card

BETA: feature complete, but not used in production yet.

Usage

Usage:
  cronmutex [flags] <MUTEX-NAME> <COMMAND>

Flags:
  -c, --config string       config file (default is /etc/cronmutex.yml)
  -f, --fire-n-forget       Don't hold (extend) the lock while the command is running
  -h, --help                help for cronmutex
  -m, --mutex-ttl int       The TTL of the lock in X seconds
  -n, --noout               Don't dump STDOUT and STDERR from command
  -w, --random-wait int32   Wait for a random duration between 0 and X seconds before acquiring the lock and starting the command
  -t, --ttl int             Kill command after X seconds. Default is to wait until the command finishes by itself
  -v, --verbose             Tell what's happening with cronmutex
      --version             Print version and exit
  • --config Set path to config file instead of using the default /etc/cronmutex.yml

  • --fire-n-forget Don't hold (extend) the lock while the command is running. Just keep lock until the lock's TTL (--mutex-ttl) expires and continue running the command without holding the lock (unless a --ttl is set and the command gets killed before).

  • --mutex-ttl X The TTL of the lock in X seconds. Note that unless --fire-n-forget is set as well, the lock keeps getting extended by this amount before it expires until the command finishes and the lock gets released.

  • --noout Don't dump STDOUT and STDERR from command.

  • --random-wait X Wait for a random duration between 0 and X seconds before acquiring the lock and starting the command.

  • --ttl X Kill command after X seconds. Default is to wait until the command finishes by itself.

  • --verbose Tell what's happening with cronmutex.

  • --version Print version and exit

Configuration

Unless overwritten by the --config option, cronmutex looks for a cronmutex.yml in /etc, $HOME/.config and current working directory.

Example config:

redis:
  uri: redis://127.0.0.1:6379
  #password: thepasswordifneeeded
mutex:
  prefix: EXAMPLEPREFIX.
  defaultTTL: 300

Build

On Linux:

$ mkdir cronmutex && cd cronmutex
$ export GOPATH=$PWD
$ go get -d github.com/emgag/cronmutex
$ cd src/github.com/emgag/cronmutex
$ dep ensure -update
$ make install

will download the source and builds binary called cronmutex in $GOPATH/bin.

License

cronmutex is licensed under the MIT License.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL