Shell Script OSX - VM Fusion (VMRun) -


i'm trying create shell script check if vm running on osx if it's not running want start it, have way i've come check if it's running, , way start if it's not. not have syntax make work... appreciated:

command 1

/applications/vmware\ fusion.app/contents/library/vmrun list | grep -q ".vmx"  

which return '.vmx' if there active vm running on vmfusion. want use command , make conditional use in correspondence command:

command 2

/applications/vmware\ fusion.app/contents/library/vmrun -t fusion start "pathtovmxfile/windows 7.vmx" 

which start vm.

the logic be:

infinite loop { command 1 if return of command 1 not ".vmx" run command 2 else  nothing continue looping } 

you mean like:

while true;     command_one=$(/applications/vmware\ fusion.app/contents/library/vmrun list | grep -q \".vmx\")     if [ $command_one = ".vmx" ];         $(/applications/vmware\ fusion.app/contents/library/vmrun -t fusion start \"pathtovmxfile/windows 7.vmx\")     else         sleep 1;     fi done 

Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -