VMware {code} Community
marck004
Contributor
Contributor

Run Commands in Guest OS

I am running my Perl SDK scripts from within a Linux VM on vSphere 5.5.  My goal is to run commands from this VM on other guest Linux VMs on the same vSphere host.  I have read that so long as the other guest OSs have VMTools installed this is doable, but I have not found a way...or the proper documentation.

An example of a task I am looking to accomplish would be to invoke a process that looks in a specific directory within other Linux guest VMs and test if a file (testfile.txt) is present - basically performing: ls -1 /var/temp/testpath/testfile.txt 2> /dev/null

To restate this goal, I have one linux VM (linuxVM01) that I have setup and currently has access to vSphere as an admin.  I want this VM (linuxVM01) to have a script that polls other Linux VMs (linuxVM02, linuxVM03, etc) to see if a particular file exists within a particular directory.

Any assistance is greatly appreciated.

Reply
0 Kudos
1 Reply
stumpr
Virtuoso
Virtuoso

I would probably recommend looking at some tooling like Ansible as your first pass at this, the assumption being you may want to do more complicated in-guest operations and potentially stage into some configuration management activity.

However, if are looking to leverage the out-of-band connectivity of the vSphere GuestOperations API (VIX), then you really don't have too many choices. Smiley Happy

lamw‌ actually wrote an example of using the GuestOperations API.   http://www.virtuallyghetto.com/2011/07/automating-new-integrated-vixguest.html

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos