Skip to content

Instantly share code, notes, and snippets.

@geetarista
Created August 29, 2013 21:54
Show Gist options
  • Save geetarista/6383920 to your computer and use it in GitHub Desktop.
Save geetarista/6383920 to your computer and use it in GitHub Desktop.
Global status for all Vagrant boxes.
#!/usr/bin/env bash
echo "Searching for Vagrant boxes..."
for file in $(find / -type f -name Vagrantfile 2>/dev/null); do
dir=$(dirname $file)
echo "Status for ${dir}:"
pushd $dir > /dev/null
out="$(vagrant status)"
popd > /dev/null
out="${out/Current machine states\:/}"
out="${out/The environment has not yet been created. Run \`vagrant up\` to/}"
out="${out/create the environment. If a machine is not created, only the/}"
out="${out/default provider will be shown. So if a provider is not listed,/}"
out="${out/then the machine is not created for that environment./}"
out="${out/The environment has not yet been created. Run \`vagrant up\` to create the environment. If a machine is not created, only the default provider will be shown. So if a provider is not listed, then the machine is not created for that environment./}"
out="${out/The VM is powered off. To restart the VM, run \`vagrant up\`/}"
echo " " $out
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment