Skip to content

psyhomb/zklock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

About

zklock.py allows you to run any shell command while acquiring distributed lock over Zookeeper, similar what flock does except it acquires local lock (over local file).

Requirements

This script requires kazoo python module, you can find out more about it here

Usage

Command line only

zklock.py --server zookeeper.example.com --port 2181 --project test --command "service test restart"

Command line with configuration file zklock.conf

[zklock]
server = zookeeper.example.com
port = 2181
lock_timeout = 10
delay_exec = 1
project = test
command = service test restart
zklock.py --config zklock.conf

Also if you want or need to, you can simulate different states by using true/false commands

Simulate OK state

zklock.py --server zookeeper.example.com --port 2181 --project test --command true

Simulate FAILED state

zklock.py --server zookeeper.example.com --port 2181 --project test --command false

License and Authors

Author: Milos Buncic

About

Acquire distributed lock over Zookeeper

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages