Simulate clicking the Save & Apply button

I wrote a script that includes uci set to control dnsmasq. But even if I use uci commit, there is still no change. Only when I click Save & Apply on the webui does the change occur

script:

uci set dhcp.@dnsmasq[0].server=127.0.0.1#1053
uci set dhcp.@dnsmasq[0].noresolv=1
uci commit dhcp.@dnsmasq[0]
/etc/init.d/dnsmasq restart

Try using this line instead:

uci commit dhcp
2 Likes

Thanks for reply, but uci commit dhcp still doesn't work. After I execute uci commit dhcp, I click Save & Apply on the webui, but it still displays Applying configuration changes…

I meant that you should replace the line in your script.. so it would be

uci commit dhcp
/etc/init.d/dnsmasq restart

did you try that (with the dnsmasq restart after the commit)?

Yes, I did that. Now the script is

uci set dhcp.@dnsmasq[0].server=127.0.0.1#1053
uci set dhcp.@dnsmasq[0].noresolv=1
uci commit dhcp
/etc/init.d/dnsmasq restart