Last active
April 6, 2017 08:55
-
-
Save shawn111/bbe03642d1a917913b3bbfc023464e80 to your computer and use it in GitHub Desktop.
Juju nodes might lost connection with juju agent. This script help us to restart those jujud.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# https://pastebin.canonical.com/183117/ | |
# # trusty | |
# for j in $(initctl list | awk '/jujud/ {print $1}'); do echo sudo restart $j; done | |
# # xenial | |
# for j in $(systemctl list-unit-files | awk '/jujud/ {print $1}'); do echo sudo systemctl restart $j; done | |
for i in $(juju status --format yaml| grep 'agent lost' | awk '{print $1}'); | |
do | |
## for juju 1 | |
#for i in $(juju status --format yaml | grep 'agent is lost' | awk '{print $9}'); | |
#do | |
# i=${i:0:(-1)} | |
JUJUD_LIST=`juju ssh $i initctl list | awk '/jujud/ {print $1}'` | |
for JUJUD in $JUJUD_LIST; do | |
juju ssh $i sudo service $JUJUD restart | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/Roadmaster/e3fde11eb4586064ab39df21bcdbaab3
similar solution