summaryrefslogtreecommitdiff
path: root/krang_backup.sh
diff options
context:
space:
mode:
authordoc <doc@filenotfound.org>2025-06-30 20:11:52 +0000
committerdoc <doc@filenotfound.org>2025-06-30 20:11:52 +0000
commit41e897f4945aaf8fbcdf0b12ac2f08c5e6ae0458 (patch)
treedb7c3520fd91abc3cf56b1a52095d23f3a80d059 /krang_backup.sh
commit of legacy codeHEADmaster
Diffstat (limited to 'krang_backup.sh')
-rwxr-xr-xkrang_backup.sh32
1 files changed, 32 insertions, 0 deletions
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