Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Christoph J. Scherr | 87edd1c4d1 |
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail # Strikte Fehlerbehandlung
|
||||
|
||||
# Check für Parameter
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <minutes>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MINS="$1" # Quote für safety
|
||||
CREDS=$(cat /root/secret/ntfy.txt || exit 1) # Explizites error handling
|
||||
TOPIC="KX8E5dbho7Q4VUVi-feed"
|
||||
|
||||
# Sende Notification
|
||||
if ! curl -f -s \
|
||||
-u "$CREDS" \
|
||||
-d "Homeserver fährt in $MINS Minuten runter." \
|
||||
-H "Title: Server Shutdown" \
|
||||
-H "Priority: high" \
|
||||
https://ntfy.sh/$TOPIC; then
|
||||
echo "Failed to send notification"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Warte auf Zustellung
|
||||
sleep 5
|
||||
|
||||
# Führe Shutdown aus
|
||||
shutdown "$MINS"
|
Loading…
Reference in New Issue