June 15, 201214 yr I would like some help scripting a shutdown routine for multiple virtualbox vm's. Here is the command line sequence that works fine, I just need a little help scripting the variables so it will work for anyone. vboxmanage list runningvms returns the list of running vms one per line in the format "VMName" {long vm id code} Which needs to be fed one at a time to this line vboxmanage controlvm "VMName" savestate Which returns a status of 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% at which point it returns to the command line. When vboxmanage list runningvms returns to the command line with no entries, the script should exit. What I envision is a variable that gets filled by whatever is between the quotes in the first line returned by the list command, if that variable is empty, exit the script, else issue the savestate with that variable, wait for the status to return, and rerun the list command. Any help? Thanks.
June 15, 201214 yr Author Here's what I've found so far. I'd like to echo the output to the syslog instead of the console. vboxmanage list runningvms|cut -d\" -f2 |while read VM; do echo "Saving state and powering off VM: $VM ..." vboxmanage controlvm "$VM" savestate done Any help?
June 15, 201214 yr I suspect if you read here about the "logger" command it will work but having NO experience with this I could easily be wrong.
Archived
This topic is now archived and is closed to further replies.