How can i update/refresh DNS records using console

I figured out that the file that stores my wifi dns settings is /etc/resolv.conf. I want to create a script that will change them to something else when i press a button on my remote…but what is the command to ‘refresh’ the dns records in Kodi as well ?
None of the following methods are valid for osmc

sudo /etc/init.d/nscd restart
sudo /etc/init.d/networking restart
sudo /etc/init.d/dns-clean start
sudo service nscd restart

What’s the proper command ? So i dont have to do it manually all the time via MyOSMC.

There is no DNS caching in OSMC by default. So you shouldn’t need to do anything.

BTW resolv.conf is written by connman automatically so expect your changes to be overwritten at unexpected times.

A better approach would be to use connmanctl to change the DNS servers via the proper connman API.

Nice, thanks,
For anyone interested first do connmanctl services to get your wifi’s id
Then to set up new nameserver do:
connmanctl config wifi_blahblah_your_id_managed_psk --nameservers

Btw, i see them set in MyOsmc, but do i need to restart connmanctl after i set them or it’s not needed ?

Nope, no need to restart anything. Btw if you are scripting something you can use connmanctl in non-interactive mode:

connmanctl config wifi_blahblah --nameservers

You could run this from any script as connmanctl does not require root access.


Yeah thats what i was thinking of doing. Much easier than re-writing a conf file with new dns all the time. hehe
thanks drake