Machine-readable VBoxManage list command?
-
paulehoffman
- Posts: 23
- Joined: 20. Oct 2010, 18:15
- Primary OS: Ubuntu other
- VBox Version: OSE other
- Guest OSses: many
Machine-readable VBoxManage list command?
Greetings. Before I put in a suggestion that "VBoxManage list" should have a --machinereadable optiton like "VBoxManage shwovminfo" does, I wanted to check if anyone knows of a way to automate the info, particularly from "bridgedifs".
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: Machine-readable VBoxManage list command?
Why do you need machinereadable in the list option?
To automate anything in Linux you write a script and run it.
To automate anything in Linux you write a script and run it.
-
scottgus1
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows, Linux
Re: Machine-readable VBoxManage list command?
I use a script in my backup routine that reads the "VBoxManage showvminfo" output. It's generated by a program, so all the data should ultimately be in the same places, depending on the line you need to read. Just do some experiments, find out what you want to input and see what showvminfo outputs, and write your program to extract the data:
Code: Select all
.
.
.
"C:\Program Files\Sun\VirtualBox\vboxmanage" showvminfo CVhost > status.txt
find /i /n "State: powered off" status.txt > nul
if "%Errorlevel%"=="0" goto startshutdown2
find /i /n "State: saved" status.txt > nul
if "%Errorlevel%"=="0" goto startshutdown2
.
.
.-
paulehoffman
- Posts: 23
- Joined: 20. Oct 2010, 18:15
- Primary OS: Ubuntu other
- VBox Version: OSE other
- Guest OSses: many
Re: Machine-readable VBoxManage list command?
The "machinereadable" option lets you parse the output better than screen scraping. In the example I gave, bridgedifs, you need to parse the information for each element by looking for blank lines and sucking up spaces at the beginning of each line that doesn't start at the left column. Your argument would also apply to showvminfo, which someone was nice enough to add machinereadable to.Perryg wrote:Why do you need machinereadable in the list option?
To automate anything in Linux you write a script and run it.