2024-03-19 21:35:17 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
## dependencies: curl
|
|
|
|
|
|
|
|
### This script checks if the 2 wifi interfaces are UP and ENABLED
|
|
|
|
|
2024-04-16 12:37:56 +02:00
|
|
|
HOST="$(cat /etc/config/system | grep "hostname" | awk '{print $3}')"
|
|
|
|
topicurl=https://172.26.0.15/hangar_servers
|
2024-03-19 21:35:17 +01:00
|
|
|
|
|
|
|
RADIO_STATUS=$(wifi status | grep -c "\"up\": true")
|
|
|
|
DEVICE_STATUS=$(wifi status | grep -c "\"disabled\": false")
|
|
|
|
|
|
|
|
if [ ${RADIO_STATUS} != 2 ] || [ ${DEVICE_STATUS} != 2 ] ; then
|
|
|
|
curl -k --retry 3 \
|
|
|
|
-d "wifi down in $HOST" \
|
|
|
|
-H "Title: Wifi down in $HOST" \
|
|
|
|
-H "Priority: high" \
|
|
|
|
-H "Tags: warning,boar" \
|
|
|
|
$topicurl
|
|
|
|
fi
|
|
|
|
|