snap count

This commit is contained in:
2024-03-09 15:52:26 +01:00
parent 198223ddc7
commit 82273f7289

13
check-lxc-snap-num.sh Executable file
View 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