Auto Start VMs on reboot

# AutoStart VM's that are tagged with autostart tag
# Script created by Raido Consultants -
TAG="autostart" # helper function
function xe_param()
while read DATA; do
LINE=$(echo $DATA | egrep "$PARAM")
if [ $? -eq 0 ]; then
echo "$LINE" | awk 'BEGIN{FS=": "}{print $2}'
} # Get all VMs
sleep 20
VMS=$(xe vm-list is-control-domain=false | xe_param uuid) for VM in $VMS; do
echo "Raido AutoStart Script : Checking VM $VM"
VM_TAGS="$(xe vm-param-get uuid=$VM param-name=tags)" if [[ $VM_TAGS == *$TAG* ]]
echo "starting VM $VM"
sleep 20
xe vm-start uuid=$VM
fi done

or just do this:

sleep 30
xe vm-start tags=autostart –multiple

Comments are closed.