Advertisement
AnrDaemon

VBoxVMInfo

Feb 17th, 2015
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.73 KB | None | 0 0
  1. #!/bin/sh
  2. ## Read VM info and print short summary about given VM
  3. # $Id: vboxvminfo.sh 138 2015-02-11 04:01:20Z anrdaemon $
  4. #
  5.  
  6. test -r "$HOME/.VirtualBox/VirtualBox.xml" -o -r "$HOME/.config/VirtualBox/VirtualBox.xml" || {
  7.         echo "VirtualBox main configuration file is missing. Check \$HOME path and setuid name." >&2
  8.         exit 1
  9.     }
  10.  
  11. eval $(/usr/bin/VBoxManage showvminfo "$1" --machinereadable 2> /dev/null | /bin/egrep "^(name|UUID|CfgFile|VMState)" || {
  12.             echo "Unable to get state for '$1'. Check VM registration and name spelling." >&2
  13.             echo exit 1
  14.         })
  15.  
  16. echo "Machine '$name' {$UUID}"
  17. echo "Config file '$CfgFile'"
  18. echo "Machine is in '$VMState' state since ${VMStateChangeTime}."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement