#!/bin/bash # # List autostart status for individual VMs # if [ $UID -eq 0 ]; then echo "This script should NOT be run as root." exit 1 fi # # Source config file if [ ! -f ~/.vbconfig ]; then echo "Config File ~/.vbconfig not found!" echo "Run: set-folders to create .vbconfig" exit 1 fi . ~/.vbconfig # VM_LIST=( `VBoxManage list vms | sort | awk '{print $1}'` ) printf "%20s %1s %1s \n" "Virtual Machine" "Autostart Enabled" "Autostart Delay" printf "%20s %1s %1s \n" "---------------" "-----------------" "---------------" for vm in "${VM_LIST[@]}" do vm1="${vm//\"}" CHK_AS=`VBoxManage showvminfo "${vm1}" | grep "Autostart Enabled:" | grep -c on` if [ $CHK_AS -eq 1 ]; then CHK_AS=Yes else CHK_AS=No fi AS_DELAY=`VBoxManage showvminfo "${vm1}" | grep "Autostart Delay:" | cut -d":" -f2` printf "%20s %10s %15s \n" $vm1 $CHK_AS $AS_DELAY done printf "%20s %1s %1s \n" "---------------" "-----------------" "---------------" # exit