2015-07-02 19:58:16 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
file=/tmp/banhost
|
|
|
|
|
|
|
|
gethosts() {
|
|
|
|
logger -t "banhost[$$]" "Update $file"
|
|
|
|
wget -qO- http://winhelp2002.mvps.org/hosts.txt |awk 'BEGIN{printf "0.0.0.0"}/^0\.0\.0\.0/{printf " "$2}END{exit(!FNR)}' >$file || exit 1
|
|
|
|
echo -n $time >$file.time
|
2021-08-18 12:20:04 +00:00
|
|
|
exec killall -s HUP dnsmasq
|
2015-07-02 19:58:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$ACTION" = ifup -a "$INTERFACE" = wan ]; then
|
|
|
|
read time </proc/uptime
|
|
|
|
time=${time%%.*}
|
|
|
|
|
|
|
|
[ -f $file -a -f $file.time ] || gethosts
|
|
|
|
read oldtime <$file.time
|
|
|
|
[ $((time - oldtime)) -lt 604800 ] || gethosts
|
|
|
|
fi
|