Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 7813  / 3 Years ago, mon, june 21, 2021, 4:34:13

I am writing a shell script to start a virtualbox (ubuntu). After the command I want to put a for loop to keep checking the status of virtualbox and the script comes out of the loop only after the ubuntu is fully started.
Something like



vboxmanage starvm Ubuntu



for (i= 0; i < 100; i++)
{
continue if (vbox is not on)
}


exit when vbox is fully on and execute the next command


More From » server

 Answers
6

We can use VBoxManage to query the state of a Virtual Machine. The following command will list all running virtual machines on your system:



VBoxManage list runningvms


The output will show you the following information which you can then further parse in your script:



"name_of_machine" <UUID>


This will of course not tell you whether the guest OS had booted properly, or is ready to use. For such informations you may need to run a script on the guest starting after boot to send it's running state to the host.


[#30755] Tuesday, June 22, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fishutt

Total Points: 391
Total Questions: 137
Total Answers: 106

Location: Mexico
Member since Tue, Aug 11, 2020
4 Years ago
;