I do have a requirement to restart network (/etc/init.d/network) whenever there is a config change for a NEW section I added.
option name 'guru'
option vlanid '100'
option enable '1'
option port 'eth0.3'
option enable '1'
option vlan 'Device.Bridging.Bridge.1.VLAN.0'
Under /etc/init.d/network I added the below config:
procd_set_param watch network.interface
procd_set_param watch network.vlanport
procd_set_param watch network.vlan
Now, with this change can I expect that the NW restart will happen whenever there is a change in the network.vlanport or network.vlan ?
No you cannot expect that. The following command will ensure that:
OK Thannks. However I dint want to do that (/etc/init.d/network restart) ; Instead need to do only when my config section changes. How can I do the same?
Then, you only run the command after you save a config.
Ok. In that case how the existing procd watch of network works? When I change anything in the network section it does auto restart after a while
Also, This config would be changed by several interfaces like SNMP/GUI/TR069 and dont want to do NW restart triggered after config change instead applied alog with other changes after procd NW restart.
Changes to /etc/config/network trigger the config reload mechanism which sends a reload signal to netifd to recalculate the desired configuration state. This state is then compared to the effective runtime configuration state and only the settings which differ are applied by using various syscalls and netlink apis.
This mechanism will not work for options netifd does not know about. I assume the
config vlanport section is a configuration extension specific to your local OpenWrt modification. The best course of action would be to write a custom service (which can consist of a sole init script triggering a command) which subscribes to
/etc/config/network changes by using
This will then issue an
/etc/init.d/yourscript reload whenever the contents of
/etc/config/network changed since the last run of your script. It is then up to your script (or the program it invokes) to compare the new value with the one being effective momentarily and decide whether actions have to be taken to make it effective or not.
procd_set_param watch statement does not refer to configuration items in uci files, but to ubus objects being supervised for changes.