connected
event is for the public ISP address, versus no address or the cable modem temporary address while the modem initializes. You could check similarly for realip if you know what it shouldn’t be (empty or private).# cat wan-event
#!/bin/sh
WANUNIT="$1"
WANIP="$(nvram get wan${WANUNIT}_ipaddr)"
STATE="$2"
if [ "$STATE" = "connected" ] && [ ! -f /tmp/adblock/blocklist.gz ]; then
case $WANIP in
0.0.0.0|192.168.100.*) ;;
*) /jffs/addons/adblock/adblock.sh update & ;;
esac
fi
local tries
tries=0
until [ "$(nvram get link_internet)" = "2" ] || [ "${tries}" -ge "6" ]; do
logmsg "Waiting for internet connection..."
sleep 5
tries=$(( tries + 1 ))
done
[ "${tries}" -eq "0" ] || logmsg "Internet connected!"
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!