I have a very simple procd init script as follows
procd_set_param command /usr/bin/abnet
procd_add_interface_trigger "interface.up" br-lan /etc/init.d/abnet restart
basically it starts a program under /usr/bin and I want it to be restarted every time when br-lan interface gets up which may indicate some network changes.
I have tried to use
procd_add_interface_trigger "interface.up" br-lan
procd_add_interface_trigger "interface..up" br-lan
procd_add_interface_trigger "interface." br-lan
and also put double quotation marks around "br-lan" and all combinations
but no matter how I play with
ifconfig br-lan down/up
I don't see the service is getting restarted
(this can be simply verified by checking the process id with top)
I have checked all relevant openwrt developer guide pages and some other online discussions but couldn't get a solution.
Hope someone can give me a hand on this.
Thanks in advance
Your most likely problem is that br-lan does not really do the up down dance at all, and hence does not trigger hotplug. I am not sure this is by design, but it certainly works like that, or rather does not work in this case, for at least a few years... I believe a bride will only go down if all members went down. And especially for switches connected to the bridge, in all likelihood, it will be the CPU port that matters and not the external ports that can easily be re-plugged to force a down event. But this is conjecture on my part since I do not know how this was intended to work.
Hi moeller0, thanks a lot for the insights. It makes sense. the br-lan is a virtual interface. my actual requirement is to start the service only after the interface is available in the system; otherwise, the process will be hanging. I have tried to set starttime=99 but found that won't guarantee the sequence. I was thinking to check if /sys/class/net/br-lan/operstate is up in a loop then bring up the service but do not know how to put it in procd init script correctly. Appreciate if you could share an example if you are aware of, thanks