Hi,
We use the failover between mobile and WAN (satellite) interfaces and to force one interface, we change the interface priorities with these commands in order to mimic programmatically the changes done by the web interface manually:
ubus call uci set '{"config": "network", "section": "wan", "type":"interface", "values": {"metric": "0"}}'
ubus call uci set '{"config": "network", "section": "mob1s1a1", "type":"interface", "values": {"metric": "1"}}'
ubus call uci set '{"config": "network", "section": "mob1s2a1", "type":"interface", "values": {"metric": "2"}}'
ubus call uci set '{"config": "mwan3", "section": "wan_member_mwan", "type":"member", "values": {"metric": "0"}}'
ubus call uci set '{"config": "mwan3", "section": "mob1s1a1_member_mwan", "type":"member", "values": {"metric": "1"}}'
ubus call uci set '{"config": "mwan3", "section": "mob1s2a1_member_mwan", "type":"member", "values": {"metric": "2"}}'
ubus call uci commit '{"config": "network"}'
ubus call uci commit '{"config": "mwan3"}'
Actually, these commands are sent through the JSON-RPC interface from another PC on LAN.
But from time to time (after some minutes and a couples of switches) the mwan3 program stop working. In facts it is stuck on a lock:
root@Teltonika-RUTX09:~# ps | grep mwan3
12486 root 1260 S /bin/sh /etc/rc.common /etc/init.d/mwan3 reload
12525 root 1384 S /bin/sh /usr/sbin/mwan3 restart
13248 root 1136 S lock /var/run/mwan3.lock
13254 root 1136 S lock /var/run/mwan3.lock
13258 root 1136 S lock /var/run/mwan3.lock
17477 root 1136 R grep mwan3
And the parent ID of the process owning the lock is 1 (init) so the process is an orphan and unlock is never called:
root@Teltonika-RUTX09:~# grep PPid: /proc/`cat /var/run/mwan3.lock`/status | grep -o "[0-9]*"
1
And killing this process allows mwan3 to restart and work again.
This issue is quite annoying on an unmanned vehicle.
Is there an issue with the commands in our script? Is there a better way to force one interface or another while using the failover?
Thank you