From 5f77376a46858831740468845c0641f4764f1537 Mon Sep 17 00:00:00 2001 From: Jose Henrique Date: Sat, 16 Aug 2025 22:35:10 -0300 Subject: [PATCH] updating backup.sh --- backup.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/backup.sh b/backup.sh index fb1d71d..910feba 100644 --- a/backup.sh +++ b/backup.sh @@ -6,10 +6,6 @@ SERVER_FILE="https://git.ivanch.me/ivanch/server-scripts/raw/branch/main/backup. SERVER_OK=1 HOSTNAME=$(cat /etc/hostname) -# Check if the server file exists -curl -s --head $SERVER_FILE | head -n 1 | grep -E "HTTP/[12] [23].." > /dev/null - -if [ $? -ne 0 ]; then NOTIFY_URL="http://notify.haven" # Function to send notification @@ -20,6 +16,11 @@ send_notify() { -H "Content-Type: application/json" \ -d "{\"title\": \"$title\", \"message\": \"$message\"}" } + +# Check if the server file exists +curl -s --head $SERVER_FILE | head -n 1 | grep -E "HTTP/[12] [23].." > /dev/null + +if [ $? -ne 0 ]; then echo "Error: $SERVER_FILE not found." >&2 send_notify "[Docker Backup][$HOSTNAME] Error" "❌ Server file not found: $SERVER_FILE" SERVER_OK=0 @@ -57,9 +58,6 @@ REMOTE_USER="ivanch" REMOTE_HOST="nas.haven" REMOTE_DIR="/export/Backup/Docker/$(cat /etc/hostname)" -# Create a compressed backup file -zip -r $BACKUP_FILE $SOURCE_DIR - # Create a compressed backup file if ! zip -r $BACKUP_FILE $SOURCE_DIR; then send_notify "Backup Error" "❌ Failed to create backup archive for: $SOURCE_DIR"