Hey,

I've missed an auto-snapshot feature for my proxmox installation, automated backups are possible.

But I rather would like to instant restore a vm than retrieving a backup, at least for the first 7 days.

Because I run backups only on weekend to the storage server.

Here is my code for it:

#!/bin/bash
TODAY_DAY=$(date +%a | tr '[:upper:]' '[:lower:]')

echo "Reading Container in /pools/LXC-Backup"
for VMID in $(pvesh get /pools/LXC-Backup/ --output-format json-pretty | jq '.members | .[].vmid');
do
    if [[ $(pct list | grep $VMID) == *"$VMID"* ]]
    then
        echo "CT $VMID - Delete Snapshot"
        pct delsnapshot $VMID "auto_snap_$TODAY_DAY"
        echo "CT $VMID - Snapshot"
        pct snapshot $VMID "auto_snap_$TODAY_DAY"
    fi
done
echo ""
echo "Reading VMs in /pools/VM-Backup"
for VMID in $(pvesh get /pools/VM-Backup/ --output-format json-pretty | jq '.members | .[].vmid');
do
    if [[ $(pct list | grep $VMID) == *"$VMID"* ]]
    then
        echo "VM $VMID - Delete Snapshot"
        qm delsnapshot $VMID "auto_snap_$TODAY_DAY"
        echo "VM $VMID - Snapshot"
        qm snapshot $VMID "auto_snap_$TODAY_DAY"
    fi
done