commandline tool to allow running cronjobs on multiple hosts while ensuring that it only runs once at a time
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
package
testutils
vendor
.gitignore
.travis.yml
Dockerfile
LICENSE
Makefile
README.md
command_locker.go
command_locker_test.go
docker-compose.yml
main.go

README.md

cronlocker

Build Status

cronlocker is a commandline tool to allow running cronjobs on multiple hosts while ensuring that it only runs once at a time. cronlocker utilizes the consul lock feature to ensure that.

Usage

cronlocker can be easily executed by passing a key to lock as well as a command to be executed if the lock could be obtained successfully.

cronlocker -key=<key/to/lock> <command>

Use cronlocker --help to get the following output:

Usage of ./cronlocker:
  -endpoint string
        endpoint (default "http://localhost:8500")
  -key string
        key to monitor, e.g. cronjobs/any_service/cron_name (default "none")
  -lockwaittime int
        Configures the wait time for a lock in milliseconds (default 500)
  -minlocktime int
        Configures the minimum time in milliseconds a lock is held (default 5000)

Packaging

Execute make package to package the application as a debian package.

Note: fpm is required

Bugs and Contribution

For bugs and feature requests open an issue on Github. For code contributions fork the repo, make your changes and create a pull request.

License

LICENSE