Created
January 27, 2013 21:36
-
-
Save Shchvova/4650725 to your computer and use it in GitHub Desktop.
Launch virtual machine, wait for it's network up, and ssh to it
./startbox.sh EditorBox vlad
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 | |
VMNAME=$1 | |
IPVMA=`VBoxManage guestproperty get $VMNAME /VirtualBox/GuestInfo/Net/0/V4/IP | awk '{ print $2 }'` | |
if [[ "$IPVMA" = "value" ]]; then | |
echo -n Starting up new instance.. | |
VBoxManage startvm $VMNAME --type headless > /dev/null | |
else | |
echo -n Connecting to running VM.. | |
fi | |
while [ "$IPVMA" = "value" ]; do | |
sleep 0.5s | |
echo -n . | |
IPVMA=`VBoxManage guestproperty get $VMNAME /VirtualBox/GuestInfo/Net/0/V4/IP | awk '{ print $2 }'` | |
done | |
echo . Done! | |
sleep 0.5s | |
ssh $2@$IPVMA |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment