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

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

c# - Populating Gridview inside Listview ItemTemplate On Web User Control from Code Behind -