Skip to content

Instantly share code, notes, and snippets.

@mateuszgachowski
Created October 28, 2013 08:57
Show Gist options
  • Select an option

  • Save mateuszgachowski/7193481 to your computer and use it in GitHub Desktop.

Select an option

Save mateuszgachowski/7193481 to your computer and use it in GitHub Desktop.
#!/bin/bash
running=$(VBoxManage list runningvms | grep -c "PHP virtualbox")
if ((running == 0))
then
echo 'Starting VirtualBox machine...'
VBoxManage startvm "PHP virtualbox" --type headless
echo '##############################'
echo 'Waiting for the VM to start...'
sleep 10
echo '##############################'
fi
echo 'Connecting to VM SSH...'
ssh login@domain.com
echo 'VM has been closed.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment