Quantcast
Channel: Proxmox Support Forum
Viewing all articles
Browse latest Browse all 171704

Create Scheduled VM Snapshot via Bash Script

$
0
0
Hi all
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

Viewing all articles
Browse latest Browse all 171704

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>