Skip to content

Instantly share code, notes, and snippets.

@rfairburn
Last active August 29, 2015 14:04
Show Gist options
  • Save rfairburn/eaa79a3d7d9ba524049b to your computer and use it in GitHub Desktop.
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)
#!/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