Skip to content

Instantly share code, notes, and snippets.

@tlvenn
Created April 15, 2017 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlvenn/21ebe8a7919a6c568d6ee99a78094fd7 to your computer and use it in GitHub Desktop.
Save tlvenn/21ebe8a7919a6c568d6ee99a78094fd7 to your computer and use it in GitHub Desktop.
mkfifo mylock.fifo
ETCDCTL_API=3 ./bin/etcdctl lock mylock >mylock.fifo &
pid=$!
if read lockname <mylock.fifo; then
echo holding lock with key $lockname
... do whatever ...
fi
kill $pid
wait $pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment