Hi all
I want you opinion about this script for create scheduled vm snapshot and delete oldest then 7 days:
Read more
I want you opinion about this script for create scheduled vm snapshot and delete oldest then 7 days:
Code:
#!/bin/bash
# ID della VM
VMID="100"
# Snapshot Name
SNAPSHOT_NAME="snapshot-$(date +%Y-%m-%d_%H-%M-%S)"
# Create snapshot
/usr/sbin/qm snapshot $VMID $SNAPSHOT_NAME
# Remove snapshot oldest then 7 days
/usr/sbin/qm listsnapshot $VMID | grep -E '^ [0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}-[0-9]{2}' | while read SNAPSHOT; do
SNAPSHOT_DATE=$(echo $SNAPSHOT | awk...
Read more