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 --- krang_backup.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 krang_backup.sh (limited to 'krang_backup.sh') diff --git a/krang_backup.sh b/krang_backup.sh new file mode 100755 index 0000000..45d1a34 --- /dev/null +++ b/krang_backup.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +STAMP=$(date +%Y%m%d-%H%M%S) +VAULT_HOST="root@thevault.sshjunkie.com" +TG_BOT_TOKEN="8178867489:AAH0VjN7VnZSCIWasSz_y97iBLLjPJA751k" +TG_CHAT_ID="1559582356" +TG_API="https://api.telegram.org/bot$TG_BOT_TOKEN/sendMessage" + +# Source directories to back up +SOURCE_DIRS=( + "/home/doc/genesis-tools/" + +) + +# Destination directories on the vault +DEST_DIRS=( + "/nexus/krang_assets" + +) + +# Rsync commands to back up directories +for i in "${!SOURCE_DIRS[@]}"; do + # Rsync to the vault (using SSH) + rsync -avz --delete "${SOURCE_DIRS[$i]}" "$VAULT_HOST:${DEST_DIRS[$i]}$STAMP/" + + # Check if the rsync was successful and send a Telegram message + if [ $? -eq 0 ]; then + curl -s -X POST "$TG_API" -d chat_id="$TG_CHAT_ID" -d text="📦 Krang backup complete for ${SOURCE_DIRS[$i]} → ${DEST_DIRS[$i]}$STAMP" + else + curl -s -X POST "$TG_API" -d chat_id="$TG_CHAT_ID" -d text="⚠️ Krang backup failed for ${SOURCE_DIRS[$i]} → ${DEST_DIRS[$i]}$STAMP" + fi +done -- cgit v1.2.3