$ICON is optional now
This commit is contained in:
38
shell_ntfy_remote_shutdown.sh
Normal file → Executable file
38
shell_ntfy_remote_shutdown.sh
Normal file → Executable file
@@ -12,21 +12,27 @@ 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"
|
||||
sshpass -p "$SSH_PASSWORD" ssh -o "StrictHostKeyChecking=no" "$SSH_USER@$SSH_HOST" "shutdown"
|
||||
#sshpass -p "$SSH_PASSWORD" ssh -o "StrictHostKeyChecking=no" "$SSH_USER@$SSH_HOST" "poweroff"
|
||||
#sshpass -p "$SSH_PASSWORD" ssh -o "StrictHostKeyChecking=no" "$SSH_USER@$SSH_HOST" "shutdown"
|
||||
|
||||
|
||||
# NTFY-Benachrichtigung vorbereiten
|
||||
CURL_CMD="curl -s -X POST \"$NTFY_URL\" \
|
||||
-H \"Authorization: Bearer $AUTH_TOKEN\" \
|
||||
-H \"Priority: default\" \
|
||||
-H \"Tags: checkered_flag\""
|
||||
[ -n "$ICON" ] && CURL_CMD="$CURL_CMD -H \"Icon: $ICON\""
|
||||
CURL_CMD="$CURL_CMD -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\\\" }]
|
||||
}\""
|
||||
|
||||
|
||||
# Benachrichtigung senden
|
||||
/bin/bash -c "$CURL_CMD"
|
||||
Reference in New Issue
Block a user