diff options
Diffstat (limited to 'kodakmomentproxmox.sh')
-rwxr-xr-x | kodakmomentproxmox.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/kodakmomentproxmox.sh b/kodakmomentproxmox.sh new file mode 100755 index 0000000..4acbbb2 --- /dev/null +++ b/kodakmomentproxmox.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +set -euo pipefail + +### CONFIG ### +PROXMOX_HOST="root@38.102.127.162" +VMIDS=(101 103 104 105 106 108) +DEST_HOST="root@thevault.bounceme.net" +DEST_PATH="/mnt/backup3/vzdump" +TIMESTAMP=$(date +%F_%H-%M) +RETENTION_DAYS=7 + +echo "๐ฆ Starting selective VM backup via KodakMoment..." + +# Ensure base destination directory exists +echo "๐ Ensuring remote backup directory exists..." +ssh "$DEST_HOST" "mkdir -p '$DEST_PATH'" + +for VMID in "${VMIDS[@]}"; do + if [[ "$VMID" == "101" ]]; then + echo "๐ถ VM 101 is a music VM โ using rsync instead of vzdump..." + ssh doc@portal.genesishostingtechnologies.com \ + "rsync -avh /var/lib/docker/volumes/azuracast_station_data/_data/ $DEST_HOST:/mnt/backup3/azuracast/" + echo "โ
Music files from VM 101 synced to thevault." + else + REMOTE_FILE="$DEST_PATH/vzdump-qemu-${VMID}-$TIMESTAMP.vma.zst" + echo "๐ง Streaming snapshot backup of VM $VMID to $REMOTE_FILE..." + + ssh "$PROXMOX_HOST" \ + "vzdump $VMID --mode snapshot --compress zstd --stdout --storage local-lvm" | \ + ssh "$DEST_HOST" \ + "cat > '$REMOTE_FILE'" + + echo "โ
VM $VMID streamed and saved to thevault." + fi +done + +echo "๐งน Pruning old vzdump backups on thevault..." +ssh "$DEST_HOST" "find '$DEST_PATH' -type f -mtime +$RETENTION_DAYS -name 'vzdump-qemu-*.zst' -delete" + +echo "โ
KodakMoment complete โ selective backups successful." |