Created
September 8, 2014 09:33
-
-
Save anorsich/70324a09890bde8fac62 to your computer and use it in GitHub Desktop.
Wait for amazon elastic beanstalk environment become green.
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 | |
function jsonval { | |
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop | cut -d":" -f2| sed -e 's/^ *//g' -e 's/ *$//g' ` | |
echo ${temp##*|} | |
} | |
echo "Waiting 20 seconds before start checking" | |
sleep 20s | |
echo "Press [CTRL+C] to stop.." | |
VERSION=$1 | |
while true | |
do | |
json=$(aws elasticbeanstalk describe-environments --version-label "${VERSION}") | |
echo "$json" | |
prop='Health' | |
Health=`jsonval` | |
if [ "$Health" == "Green" ] | |
then | |
echo "Application is propagated, health is Green" | |
break | |
else | |
echo "Health is:" ${Health}". Will check again in 10 seconds" | |
fi | |
sleep 10s | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment