Auto commit from /home/doc/genesis-tools
This commit is contained in:
parent
75e1569001
commit
78d30cffc5
32
miscellaneous/giteapush.sh
Executable file
32
miscellaneous/giteapush.sh
Executable file
@ -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
|
@ -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."
|
||||
|
Loading…
x
Reference in New Issue
Block a user