What's new

Create Dynamic Custom Hosts File

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

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!
 
What format is the hosts file from your provider? Standard ip host_name?
 
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.
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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