From 78d30cffc54e3226f5adb5e62e54f1d79fa89c70 Mon Sep 17 00:00:00 2001 From: DocTator Date: Tue, 22 Apr 2025 10:40:37 -0400 Subject: [PATCH] Auto commit from /home/doc/genesis-tools --- miscellaneous/giteapush.sh | 32 +++++++++++++++++++++++++ miscellaneous/kodakmomentproxmox.sh | 36 ++++++++++++++++++----------- 2 files changed, 54 insertions(+), 14 deletions(-) create mode 100755 miscellaneous/giteapush.sh diff --git a/miscellaneous/giteapush.sh b/miscellaneous/giteapush.sh new file mode 100755 index 0000000..3237cd3 --- /dev/null +++ b/miscellaneous/giteapush.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e + +# Define the path to your repository and the Gitea repository URL +REPO_DIR="/home/doc/genesis-tools" +GITEA_REPO_URL="https://urban-squid.pikapod.net/doctator/scripts.git" + +# Change to the repository directory +cd "$REPO_DIR" + +# Initialize git if not already done +if [ ! -d ".git" ]; then + echo "Initializing a new git repository..." + git init + git remote add origin "$GITEA_REPO_URL" +else + echo "Git repository already initialized..." +fi + +# Check if there are any changes or untracked files +if ! git diff-index --quiet HEAD --; then + # Stage all changes + git add . + + # Commit changes + git commit -m "Auto commit from /home/doc/genesis-tools" + + # Push changes to Gitea repository + git push origin master # Or 'main' if that's the branch name +else + echo "No changes to commit." +fi diff --git a/miscellaneous/kodakmomentproxmox.sh b/miscellaneous/kodakmomentproxmox.sh index 886cf56..4acbbb2 100755 --- a/miscellaneous/kodakmomentproxmox.sh +++ b/miscellaneous/kodakmomentproxmox.sh @@ -3,30 +3,38 @@ set -euo pipefail ### CONFIG ### PROXMOX_HOST="root@38.102.127.162" -PROXMOX_TMP="/var/lib/vz/dump" -VMIDS=(102) +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 remote VM backup via Proxmox..." +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 - echo "๐Ÿง  Telling Proxmox to back up VM $VMID..." - ssh "$PROXMOX_HOST" "vzdump $VMID --dumpdir $PROXMOX_TMP --mode snapshot --compress zstd --quiet" + 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..." - echo "๐Ÿ“‚ Locating backup file for VM $VMID on Proxmox..." - LATEST_FILE=$(ssh "$PROXMOX_HOST" "ls -t $PROXMOX_TMP/vzdump-qemu-${VMID}-*.zst | head -n 1") + ssh "$PROXMOX_HOST" \ + "vzdump $VMID --mode snapshot --compress zstd --stdout --storage local-lvm" | \ + ssh "$DEST_HOST" \ + "cat > '$REMOTE_FILE'" - echo "๐Ÿš€ Transferring backup to thevault..." - ssh "$PROXMOX_HOST" "rsync -av '$LATEST_FILE' '$DEST_HOST:$DEST_PATH/'" - - echo "๐Ÿงน Cleaning up Proxmox local file..." - ssh "$PROXMOX_HOST" "rm -f '$LATEST_FILE'" + echo "โœ… VM $VMID streamed and saved to thevault." + fi done -echo "๐Ÿงน Pruning old backups on thevault..." +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 VM-host remote backup complete." +echo "โœ… KodakMoment complete โ€” selective backups successful."