check_update.sh hinzugefügt
Script start Signed-off-by: Gregor Holzfeind <1+gregor@noreply.localhost>
This commit is contained in:
1 parent
d93ad0e511
commit
4f95fac434
1 file changed
+34
@@ -0,0 +1,34 @@
|
||||
#!/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
|
||||
Reference in new issue
Block a user