Folks,
Snapshots of running vms are not recommended. Can be done with forcing (-f flag).
In order to mechanize regular vm snapshots I'm thinking to use a cron taks to call a script.
As This is not my fortè, any help will be appreciated. Here what I've started:
I'd like to have the script checking if all VMs have been stopped before continue. I could pause for a minute or so, but is there a way to check if the
finished? Or maybe check each captured pid?
Any suggestion on improving it will also be welcome.
[]'s,
Al
Snapshots of running vms are not recommended. Can be done with forcing (-f flag).
In order to mechanize regular vm snapshots I'm thinking to use a cron taks to call a script.
As This is not my fortè, any help will be appreciated. Here what I've started:
Code:
[noparse]#!/bin/bash
#
declare -a vm_name vm_pid
vm list > all.vms
vm_name=( $(awk '{print $1}' all.vms) )
vm_pid=( $(awk '{print $NF}' all.vms) )
#vm stopall
# <---------- Wait for all VMs to stop before continue ------------>
for i in "${!vm_name[@]}";
do
echo ${vm_name[$i]} " - " ${vm_pid[$i]}
if [ "${vm_pid[i]}" != "Stopped" ] && [ "${vm_pid[i]}" != "STATE" ]
then
vm snapshot ${vm_name[$i]}
vm start ${vm_name[$i]}
fi
done[/noparse]
I'd like to have the script checking if all VMs have been stopped before continue. I could pause for a minute or so, but is there a way to check if the
Code:
vm stopall
Any suggestion on improving it will also be welcome.
[]'s,
Al