debug mode and better waiting for ssh

This commit is contained in:
Jeff Lindsay
2013-06-23 01:07:21 -07:00
parent 4bb66c6c63
commit 7a1b4be14e

View File

@@ -12,7 +12,7 @@ terminate() {
echo "-----> Terminating $INSTANCE..."
ec2-terminate-instances $INSTANCE &>/dev/null && echo " Shutting down"
}
trap "terminate" EXIT
[[ $DEBUG ]] || trap "terminate" EXIT
sleep 30
status=""
while [[ "$status" != "running" ]]; do
@@ -27,6 +27,9 @@ while [[ "$status" != "running" ]]; do
done
PUBLIC_IP=$(echo "$info" | awk '{print $14}')
echo "-----> Waiting for SSH at $PUBLIC_IP..."
sleep 10
while [[ ! $(echo | nc $PUBLIC_IP 22) ]]; do
sleep 5
echo " Waiting..."
done
echo "-----> Connecting and running boostrap script..."
cat ../bootstrap.sh | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "HOSTNAME=$PUBLIC_IP sudo bash" 2>&1 | indent