Use googledomains and only notify when the IP changes

This commit is contained in:
Colin Hebert
2022-12-26 19:01:07 +01:00
parent 9b942583f7
commit 49b43db609
2 changed files with 13 additions and 8 deletions

View File

@@ -1,7 +1,12 @@
#!/bin/bash
curl -s "$GOTIFY_ADDRESS/message" \
-X POST \
-H "X-Gotify-Key: $GOTIFY_TOKEN" \
-F "title=IP Address updated" \
-F "message=IP address detected as $1" \
-F "priority=5"
if [ "$(cat /data/gotify_previous_ip || true)" != "$1" ]; then
echo -n "$1" > /data/gotify_previous_ip
curl -s "$GOTIFY_ADDRESS/message" \
-X POST \
-H "X-Gotify-Key: $GOTIFY_TOKEN" \
-F "title=IP Address updated" \
-F "message=IP address detected as $1" \
-F "priority=5"
fi