debug mode and better waiting for ssh

This commit is contained in:
Jeff Lindsay committed 2013-06-23 01:07:21 -07:00
1 parent 4bb66c6c63
commit 7a1b4be14e
1 file changed
+5 -2
+5 -2
View File
@@ -12,7 +12,7 @@ terminate() {
echo "-----> Terminating $INSTANCE..." echo "-----> Terminating $INSTANCE..."
ec2-terminate-instances $INSTANCE &>/dev/null && echo " Shutting down" ec2-terminate-instances $INSTANCE &>/dev/null && echo " Shutting down"
} }
trap "terminate" EXIT [[ $DEBUG ]] || trap "terminate" EXIT
sleep 30 sleep 30
status="" status=""
while [[ "$status" != "running" ]]; do while [[ "$status" != "running" ]]; do
@@ -27,6 +27,9 @@ while [[ "$status" != "running" ]]; do
done done
PUBLIC_IP=$(echo "$info" | awk '{print $14}') PUBLIC_IP=$(echo "$info" | awk '{print $14}')
echo "-----> Waiting for SSH at $PUBLIC_IP..." 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..." echo "-----> Connecting and running boostrap script..."
cat ../bootstrap.sh | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "HOSTNAME=$PUBLIC_IP sudo bash" 2>&1 | indent cat ../bootstrap.sh | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "HOSTNAME=$PUBLIC_IP sudo bash" 2>&1 | indent