Skip to content

Commit 87189ef

Browse files
committed
eliminate double scans
1 parent 1c15299 commit 87189ef

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

gluon-linkcheck/files/lib/gluon/linkcheck/linkcheck.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,23 @@ for link in $links; do
8080
linksexist="$linksexist $link"
8181
fi
8282
done
83+
rm /tmp/linkcheck.iwscan.* 2>/dev/null
8384

8485
for linkexist in $linksexist; do
8586
linkname=$(uci get $linkexist.ifname)
86-
bsses=$(iw dev $linkname scan lowpri passive|grep $linkname|wc -l)
87-
sleep 8
87+
iwfile=/tmp/linkcheck.iwscan.$(uci get $linkexist.device)
88+
if [ ! -f $iwfile ] ; then
89+
sleep 4
90+
iw dev $linkname scan lowpri passive > $iwfile
91+
sleep 4
92+
fi
93+
bsses=$(cat $iwfile|grep "BSS .*:.*:.*:.*:.*:.*(on.*)"|wc -l)
94+
unset bssid
8895
bssid=$(uci get $linkexist.mesh_id 2>/dev/null)
8996
if [ -z "$bssid" ] ; then
9097
bssid=$(uci get $linkexist.ssid)
9198
fi
92-
neighbours=$(iw dev $linkname scan lowpri passive|grep $bssid|wc -l)
93-
sleep 2
99+
neighbours=$(cat $iwfile|grep $bssid|wc -l)
94100
checks="neighbours bsses"
95101
for check in $checks; do
96102
wert=$(eval echo \$$check)

0 commit comments

Comments
 (0)