Created
March 25, 2015 07:55
-
-
Save meyju/c7138dc1b2cd5b94ddba to your computer and use it in GitHub Desktop.
Force aws instance start
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 | |
# | |
# Info: Script trys to start an aws instance, if the region is out of capacity | |
# Autor: Julian Meyer | |
# Version: 0.1 | |
# | |
# USE AT YOUR OWN RISK! | |
if [ $# -lt 1 ]; then | |
echo "Usage: $0 [instance-id] [...]" | |
exit 1 | |
fi | |
export AWS_DEFAULT_REGION="eu-central-1" | |
COUNTER=0 | |
RC=1 | |
while [ $RC -gt 0 ] | |
do | |
aws ec2 start-instances --instance-ids $@ 2>/dev/null | |
RC=$? | |
let COUNTER=COUNTER+1 | |
echo "RC=$RC - `date` - Versuche: $COUNTER" | |
echo "" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment