bayern1975
Very Senior Member
1. Standard method (the original)
The files are stored on a USB disk, /tmp/mnt/sda1/ is the path. If you use /jffs/ edit accordingly.
Using a USB disk we need to delay the startscript.
This will create an up-to-date hosts file after every reboot.
Add to /jffs/scripts/post-mount
Code:
#!/bin/sh
sleep 12
wget -qO- "http://winhelp2002.mvps.org/hosts.txt" "http://someonewhocares.org/hosts/zero/hosts" "http://pgl.yoyo.org/adservers/serve...tdate[year]=&mimetype=plaintext&useip=0.0.0.0" | grep -w ^0.0.0.0 | sed $'s/\r$//' | sort -u > /tmp/mnt/sda1/hosts.clean
sleep 5
service restart_dnsmasq
Tell dnsmasq to add the new hosts file and where to send the unwanted requests to (sending them to 0.0.0.0)
Create or add to /jffs/configs/dnsmasq.conf.add
Code:
address=/0.0.0.0/0.0.0.0
addn-hosts=/tmp/mnt/sda1/hosts.clean
To update the hosts file (manually or as a cron job) create /jffs/scripts/update-hosts.sh
Code:
#!/bin/sh
wget -qO- "http://winhelp2002.mvps.org/hosts.txt" "http://someonewhocares.org/hosts/zero/hosts" "http://pgl.yoyo.org/adservers/serve...tdate[year]=&mimetype=plaintext&useip=0.0.0.0" | grep -w ^0.0.0.0 | sed $'s/\r$//' | sort -u > /tmp/mnt/sda1/hosts.clean
sleep 5
service restart_dnsmasq
To run update-hosts.sh every Friday midnight as a cron job create or add to /jffs/scripts/init-start /jffs/scripts/services-start
Code:
#!/bin/sh
cru a UpdateHosts "00 00 * * 5 /jffs/scripts/update-hosts.sh"
Set all files in /jffs/scripts/ as executable
Code:
chmod a+rx /jffs/scripts/*
That's it, reboot and enjoy!
Tested on a RT-AC66U.
i have this installed on my ac68u....no errors on logfile but what files do i need to working this?
here is my log....http://pastebin.com/7N06W2tK
i see this but i do not know what is missing there?
Code:
dnsmasq[436]: failed to load names from /tmp/mnt/sda1/hosts.clean: No such file or directory
Last edited: