#!/bin/bash # Pfad zur .env-Datei dynamisch ermitteln ENV_FILE="$(dirname "$(realpath "$0")")/$(basename "$0" .sh).env" # Prüfen, ob die .env-Datei existiert if [[ ! -f "$ENV_FILE" ]]; then echo "Fehler: Konfigurationsdatei $ENV_FILE nicht gefunden." exit 1 fi # .env-Datei laden source "$ENV_FILE" # NTFY-Benachrichtigung senden curl -s -X POST "$NTFY_URL" \ -H "Authorization: Bearer $AUTH_TOKEN" \ -H "Priority: default" \ -H "Tags: checkered_flag" \ -H "Icon: $ICON" \ -H "Content-Type: application/json" \ -d "{ \"topic\": \"Duplicati\", \"title\": \"Backups beendet\", \"message\": \"QNas wird heruntergefahren.\n\nServer: $SERVER_NAME\", \"click\": \"\", \"actions\": [{ \"action\": \"view\", \"label\": \"Duplicati öffnen\", \"url\": \"$DUPLICATI_URL\" }] }" # Server herunterfahren sshpass -p "$SSH_PASSWORD" ssh -o "StrictHostKeyChecking=no" "$SSH_USER@$SSH_HOST" "poweroff"