This script allows an admin to be sure that the guest is started, and confirm that the guest really is running Apache and MySQL.
Here’s the step-by-step breakdown.
"""Demo script 1.""" from __future__ import print_function from pyvix2 import Host, Error, Tools_State import sys #guest_os= r"C:\Fedora14\Fedora.vmx" guest_os= r"G:\VMplanet-openSUSE11.3\[VMplanet] openSUSE 11.3.vmx" host= Host() host.connect() running= host.find_items() # Already Running? if running: if guest_os not in running: print( "Error:", running, "running in host, stopping." ) sys.exit(1) print( "Found", running, "already running." ) vm= host.openVM(guest_os) else: vm= host.openVM(guest_os) vm.power_on() print( "Running:", host.find_items() ) # Confirm Tools try: vm.wait_for_tools_in_guest( 60 ) except Error as e: print( e ) print( "Tools:", Tools_State[vm.tools_state.value] ) # Login and check processes vm.login( "user", "password" ) procs= vm.process_list() for pid, owner, name, start_time, command in procs: if 'apache' in name or 'mysql' in name: print( pid, owner, command )