Create Dynamic Custom Hosts File

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

bozolino

Occasional Visitor
my geo-unblock dns provider publishes a .hosts file (via a static url) that gets regular updates. i would like to reflect those updates on my router. how can i create a daily cronjob to

1. download the .hosts file from my provider
2. replace the contents of /jffs/configs/dnsmasq.conf.add with the download
3. restart the router or the relevant (sub)system to update its hosts file

many thanks in advance!
 

john9527

Part of the Furniture
What format is the hosts file from your provider? Standard ip host_name?
 

john9527

Part of the Furniture
I'd use a separate file to avoid having to completely restart dnsmasq. Then one time add the line

addn-hosts=/jffs/configs/new-host-name

to /jffs/configs/dnsmasq.conf.add

Then since the dnsmasq hosts files aren't dynamic, you need to issue

killall -SIGHUP dnsmasq

to cause the host file to be re-read after you download it.
 

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top