Skip to content

Instantly share code, notes, and snippets.

@Shchvova
Created January 27, 2013 21:36
Show Gist options
  • Save Shchvova/4650725 to your computer and use it in GitHub Desktop.
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
#!/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