Changes

Jump to: navigation, search
Running and Managing Guest Programs with vmrun
vmrun -T server -h https://xps:8333/sdk -u root -p 3579xps -gu administrator -gp guestpasswd
killProcessInGuest "[Vol1] win2008-1/win2008-1.vmx" 2368
</pre>
 
== Running Scripts Within a Guest ==
 
In addition to running executable programs on a guest operating system, ''vmrun'' also supports the running of scripts. Scripts are generally text based files containing instructions which a executed by an interpreter. For example, a Perl script would be executed using the ''perl'' interpreter and Ruby script by the ''ruby'' interpreter. Whilst some operating systems and scripting languages allow scripts to be executed just as any other program is executed (and without referring to the interpreter in the command line) this is not always the case. In such situations the command line to execute the script must provide the path to the script as a command line argument to the interpreter. For example, suppose that the following Ruby script contained in a file called ''hello.rb'' located in ''/home/ruby'' needs to be executed:
 
<pre>
print "hello ruby!\n"
print "goodbye ruby!\n"
</pre>
 
In order to execute this script, the hello.rb file needs to passed as a command line argument to the ''ruby'' interpreter program as follows:
 
<pre>
/usr/bin/ruby /home/ruby/hello.rb
</pre>
 
In essence, the task of executing a script in this way using ''vmrun'' is very similar. In the following example, the ''hello.rb'' script is executed using the ''runScriptInGuest'' command:
 
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p 3579xps -gu administrator -gp Iltsonitm129
runScriptInGuest "[Vol1] CentOS 5/Centos 5.vmx" /usr/bin/ruby /home/ruby/hello.rb
</pre>
1,798
edits

Navigation menu