diff --git a/files/all/usr/bin/wifi-sentinel.sh b/files/all/usr/bin/wifi-sentinel.sh index 88beb2b..2294736 100755 --- a/files/all/usr/bin/wifi-sentinel.sh +++ b/files/all/usr/bin/wifi-sentinel.sh @@ -1,11 +1,36 @@ #!/bin/sh . /lib/functions/network.sh -PACKETS='3' -INTERVAL='10' +p=$(uci get wifi-sentinel.@wifi-sentinel[0].packets) +if [ -z "$p" ]; then + PACKETS='3' +else + PACKETS="$p" +fi + +p=$(uci get wifi-sentinel.@wifi-sentinel[0].interval) +if [ -z "$p" ]; then + INTERVAL='10' +else + INTERVAL="$p" +fi + +p=$(uci get wifi-sentinel.@wifi-sentinel[0].network) +if [ -z "$p" ]; then + NETWORK='management' +else + NETWORK="$p" +fi + +p=$(uci get wifi-sentinel.@wifi-sentinel[0].switchport) +if [ -z "$p" ]; then + PORT=1 +else + PORT="$p" +fi + + STATUS='unknown' -NETWORK='management' -PORT='1' lightsoff() { @@ -27,7 +52,7 @@ lightson() port_check() { - LINK=`swconfig dev switch0 port 1 show | awk '/link/ {print $3}'` + LINK=`swconfig dev switch0 port $PORT show | awk '/link/ {print $3}'` if [ "$LINK" = 'link:up' ]; then return 0 else diff --git a/files/all/etc/config/wifi-sentinel b/files/archer-c5/etc/config/wifi-sentinel similarity index 79% rename from files/all/etc/config/wifi-sentinel rename to files/archer-c5/etc/config/wifi-sentinel index 61e22f5..92d9030 100644 --- a/files/all/etc/config/wifi-sentinel +++ b/files/archer-c5/etc/config/wifi-sentinel @@ -3,3 +3,4 @@ config wifi-sentinel option packets 3 option interval 10 option network 'management' + option switchport '1' diff --git a/files/dap2965/etc/config/wifi-sentinel b/files/dap2965/etc/config/wifi-sentinel new file mode 100644 index 0000000..9b29910 --- /dev/null +++ b/files/dap2965/etc/config/wifi-sentinel @@ -0,0 +1,6 @@ + +config wifi-sentinel + option packets 3 + option interval 10 + option network 'management' + option switchport '2' diff --git a/files/linksys/etc/config/wifi-sentinel b/files/linksys/etc/config/wifi-sentinel new file mode 100644 index 0000000..92d9030 --- /dev/null +++ b/files/linksys/etc/config/wifi-sentinel @@ -0,0 +1,6 @@ + +config wifi-sentinel + option packets 3 + option interval 10 + option network 'management' + option switchport '1' diff --git a/files/wdr-4300/etc/config/wifi-sentinel b/files/wdr-4300/etc/config/wifi-sentinel new file mode 100644 index 0000000..92d9030 --- /dev/null +++ b/files/wdr-4300/etc/config/wifi-sentinel @@ -0,0 +1,6 @@ + +config wifi-sentinel + option packets 3 + option interval 10 + option network 'management' + option switchport '1' diff --git a/files/wr-1043nd/etc/config/wifi-sentinel b/files/wr-1043nd/etc/config/wifi-sentinel new file mode 100644 index 0000000..92d9030 --- /dev/null +++ b/files/wr-1043nd/etc/config/wifi-sentinel @@ -0,0 +1,6 @@ + +config wifi-sentinel + option packets 3 + option interval 10 + option network 'management' + option switchport '1'