Also my check script with wifi restart that WORKS !
#next line is to test if previous instance of test.sh is still running - in case u run connectivity test every few seconds
test1=$(ps |grep "test.sh" |grep -v grep |wc -l)
PINGTEST=$(ping www.google.com -c1 -W3|grep loss| awk {'print $7'})
if [[ "$PINGTEST" != "0%" ]] && [[ $test1 == "0" ]] ; then
/bin/sh test.sh
fi
#also what i do after negative test result on connectivity (test.sh):
#! /bin/sh
/sbin/uci set wireless.ra0.disabled=1
/sbin/uci commit wireless
/sbin/reload_config
/bin/sleep 30
/sbin/uci set wireless.ra0.disabled=0
/sbin/uci commit wireless
/sbin/reload_config
/bin/sleep 30
/usr/bin/wifimanager -v
Like i said in case somebody needs the script to REALLY restart the whole wifi procedure.
Please change the line:
PINGTEST=$(ping www.google.com -c1 -W3|grep loss| awk {'print $7'})
replace www.google.com with some other address as I don't think google guys will appreciate all the pings to their server Lets say some server u rely on but under your control - again not to "attack" somebody
BR
Ales