Automatically starts and restarts VMWare VMs 💫
  • Python 91.4%
  • Shell 8.6%
Find a file
2021-08-27 11:18:55 +02:00
.gitignore Ok 2021-08-26 01:45:06 +02:00
autoVMware.py remove print 2021-08-26 02:14:38 +02:00
autoVMware.sh Ok 2021-08-26 01:45:06 +02:00
LICENSE Initial commit 2021-08-25 22:22:31 +02:00
README.md Update README.md 2021-08-27 11:18:55 +02:00

AutoVMware 🤖

Automatically starts and restarts VMWare Virtual Machines 💫

Get Started 🧙‍♂️

Launch autoVMware.sh with crontab on linux (or with task manager on windows), for example to check every minute if all VMs are running to restart them if necessary :

sudo crontab -e
# In editor
* * * * * su peterpan -c "/PATH_TO_SCRIPT/AutoVMWARE/autoVMware.sh" # You can also run directly the autoVMware.py instead of using a .sh

If you use VMware Player or Fusion instead of VMware Workstation, you need to edit all command line in the script containing the ws argument. Possibles arguments are :

  • ws for Workstation Pro
  • fusion for VMware Fusion (MacOS)
  • player fir VMware Player

example for VMware Player :

subprocess.run(f'vmrun -T ws stop "{vm_path}"', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) -> subprocess.run(f'vmrun -T player stop "{vm_path}"', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Basically the script is programmed to launch all the VMs (.vmx) contained in the folder and subfolders of /home. The PATH_TO_SEARCH variable can be modified to match the path pattern of the VMs you want to monitor with the script.

The script is designed to be run in a Linux environment, but it is easily transportable to a Windows environment with some modifications.