Skip to content

Instantly share code, notes, and snippets.

@stahnma
Last active March 25, 2016 05:07
Show Gist options
  • Save stahnma/62b69c37ab146501dbb0 to your computer and use it in GitHub Desktop.
Save stahnma/62b69c37ab146501dbb0 to your computer and use it in GitHub Desktop.
Consul Leader
#!/bin/bash
ans=`curl -s http://localhost:8500/v1/status/leader`
if [ "$?" = "0" ] ; then
ip=$(echo $ans | cut -d: -f1 | sed -e 's/"//g')
consul members | grep $ip | awk '{print $1}'
fi
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment