Get current VirtualBox Status with Vagrant

status, vagrant, virtualbox

Solution

If you want to check running status with shell script. Try this code inside your project folder

vagrant status --machine-readable | grep state,running

Then check output string or exit code

Problem

We did alot of stuff with Vagrant in the recent days, and there's a problem we encountered / didn't find any answer to. It's about checking the Status of the VirtualBox with Vagrant, for example: ``` if config.vmbox_status == 'running' # do this stuff end ``` If there is any easy way of checking / getting the current Virtual Box status let us know.

Original source