Last active
August 29, 2015 14:04
-
-
Save rfairburn/eaa79a3d7d9ba524049b to your computer and use it in GitHub Desktop.
Check for down minions until all are up (good after a salt-master restart)
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/bash | |
count=0 | |
while : ; do | |
minions=$(salt-run manage.down) | |
let count=count+1 | |
if [ -n "${minions}" ]; then | |
echo -e "The following minions are down:\e[0;31m "${minions}"\e[0m. Waiting for them to recover." | |
else | |
echo -e "\e[0;32mAll minions are running!\e[0m" | |
fi | |
if [ "${count}" -gt "15" ]; then | |
echo -e "\e[0;31mToo many attempts. Exiting.\e[0m" | |
exit 1 | |
fi | |
[ -n "${minions}" ] || break | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment