Luci change monitor

I am writing a daemon for LEDE/OpenWRT, and I would like to reload configuration whenever there is a change by the user. So I'd like to detect if someone press "apply" on the GUI. I bet that this is done using ubus. My daemon is written in lua. Could you provide how to catch such events?

Thank you,

Please provide more details about what you want to do. A specific app? Any config in the system?

There is already existing functionality in procd (and old ucitrack system) for reloading/restarting necessary apps when config changes.

I'm writing an application that checks network connectivity, and when the network is up/down for whatever reason, it changes GPIO lines etc... I store configurations in the UCI system like which GPIO lines to use. I want this to be "real time", i.e. if someone changes something, my daemon shall react asap. I don't want to poll the configurations as it'd take too long... there are also an LTE modem there I shall manage.

Everything works as expected, I only miss the configuration monitoring function.


Check network connectivity using hotplug event:

cat<<'EOF' > /etc/hotplug.d/iface/99-wan-up-down
[ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] && {
    logger "wan up"
    sleep 10
    sh -x /etc/
[ "$ACTION" = "ifdown" -a "$INTERFACE" = "wan" ] && {
    logger "wan down"
    sleep 11
    sh -x /etc/
exit 0

chmod +x /etc/hotplug.d/iface/99-wan-up-down