34 lines
915 B
Bash
34 lines
915 B
Bash
#!/bin/sh
|
|||
|
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||
|
|
|
||
|
|
# Gotify Settings
|
||
|
|
GOTIFY_URL="https://push.holzfeind.ch"
|
||
|
|
GOTIFY_TOKEN=""
|
||
|
|
|
||
|
|
check_update() {
|
||
|
|
# Aktuelle installierte Version abrufen und nur die Versionsnummer extrahieren
|
||
|
|
CURRENT_VERSION=$(opnsense-version | awk '{print $2}')
|
||
|
|
# Verfügbare Version aus dem Repository abrufen
|
||
|
|
AVAILABLE_VERSION=$(pkg rquery '%v' opnsense)
|
||
|
|
if [ "$CURRENT_VERSION" = "$AVAILABLE_VERSION" ]; then
|
||
|
|
# Keine neue Version verfügbar
|
||
|
|
exit 0
|
||
|
|
else
|
||
|
|
# Update verfügbar
|
||
|
|
send_gotify "OPNsense Update Alarm" "Update auf $HOSTNAME vorhanden" 8
|
||
|
|
fi
|
||
|
|
}
|
||
|
|
|
||
|
|
send_gotify() {
|
||
|
|
TITLE="$1"
|
||
|
|
MESSAGE="$2"
|
||
|
|
PRIORITY="$3"
|
||
|
|
|
||
|
|
curl -s \
|
||
|
|
-X POST "${GOTIFY_URL}?token=${GOTIFY_TOKEN}" \
|
||
|
|
-F "title=${TITLE}" \
|
||
|
|
-F "message=${MESSAGE}" \
|
||
|
|
-F "priority=${PRIORITY}" >/dev/null
|
||
|
|
}
|
||
|
|
|
||
|
|
check_update
|