wifiStatus.sh 719 B

1234567891011121314151617181920
  1. #!/bin/sh
  2. ## update status bar based on wifi connection status
  3. FILE="/tmp/wifi-active"
  4. if [ "$ACTION" = "ifup" ]; then
  5. if [ "$DEVICE" = "apcli0" ]; then
  6. mosquitto_pub -t '/status' -m '{ "cmd":"update", "elements": [ { "type": "wifi", "value": 1 } ] }'
  7. echo "1" > $FILE
  8. fi
  9. elif [ "$ACTION" = "ifdown" ]; then
  10. # TODO: potentially change this device, sometimes shows just "" when if goes down
  11. # if [ "$DEVICE" = "apcli0" ]; then
  12. # mosquitto_pub -t '/status' -m '{ "cmd":"update", "elements": [ { "type": "wifi", "value": 0 } ] }'
  13. # fi
  14. # note: device is generally blank when wifi goes down
  15. mosquitto_pub -t '/status' -m '{ "cmd":"update", "elements": [ { "type": "wifi", "value": 0 } ] }'
  16. rm -rf $FILE
  17. fi