You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
497 B

  1. #!/bin/sh
  2. file=/tmp/banhost
  3. gethosts() {
  4. logger -t "banhost[$$]" "Update $file"
  5. 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
  6. echo -n $time >$file.time
  7. exec killall -s HUP dnsmasq
  8. }
  9. if [ "$ACTION" = ifup -a "$INTERFACE" = wan ]; then
  10. read time </proc/uptime
  11. time=${time%%.*}
  12. [ -f $file -a -f $file.time ] || gethosts
  13. read oldtime <$file.time
  14. [ $((time - oldtime)) -lt 604800 ] || gethosts
  15. fi