snap count
This commit is contained in:
13
check-lxc-snap-num.sh
Executable file
13
check-lxc-snap-num.sh
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
snapshotnum=3
|
||||||
|
updatescript=$(dirname "$0")/update-lxc-container.sh
|
||||||
|
echo $(date) "- Check if there're at least ${snapshotnum} lxc containers snapshot..."
|
||||||
|
if [ $(lxc list type=container -c S --format csv | head -1) -lt ${snapshotnum} ]; then
|
||||||
|
echo $(date) "- Create VMs/containers snapshot and update containers..."
|
||||||
|
for vm in $(lxc list type=virtual-machine -c n --format csv); do
|
||||||
|
lxc snapshot ${vm}
|
||||||
|
done
|
||||||
|
${updatescript}
|
||||||
|
else
|
||||||
|
echo $(date) "- Do nothing."
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user