Created
January 26, 2015 10:00
-
-
Save scemama/6ffa7683ca6ee269dc3c to your computer and use it in GitHub Desktop.
Cron to keep VMs on
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VMS=$(VBoxManage list vms | cut -d ' ' -f 1 | tr '"' ' ') | |
for VM in $VMS | |
do | |
VBoxManage list runningvms | cut -d ' ' -f 1 | grep $VM > /dev/null | |
if [[ $? -ne 0 ]] | |
then | |
VBoxManage startvm $VM --type=headless | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment