From 41e897f4945aaf8fbcdf0b12ac2f08c5e6ae0458 Mon Sep 17 00:00:00 2001 From: doc Date: Mon, 30 Jun 2025 20:11:52 +0000 Subject: commit of legacy code --- kodakmomentproxmox.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 kodakmomentproxmox.sh (limited to 'kodakmomentproxmox.sh') 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." -- cgit v1.2.3