I recently installed Openwrt on a "Zyxel LTE5398-M904"
I apologize in advance if the question might be trivial
I ask if anyone might have suggestions and/or opinions that would allow better management
I created a script that runs every minute it checks the connection
with the command:
uqmi -d /dev/cdc-wdm0 --get-data-status | grep "disconnected"
I would like to know how reliable such a way should be to detect any disconnections
Below is the common information that is usually requested:
ubus call system board
{
"kernel": "5.15.147",
"hostname": "LTE5398-M904",
"system": "MediaTek MT7621 ver:1 eco:3",
"model": "ZyXEL LTE5398-M904",
"board_name": "zyxel,lte5398-m904",
"rootfs_type": "squashfs",
"release": {
"distribution": "OpenWrt",
"version": "SNAPSHOT",
"revision": "r24936-60ffcfdabc",
"target": "ramips/mt7621",
"description": "OpenWrt SNAPSHOT r24936-60ffcfdabc"
}
}
cat /etc/config/network
config interface 'wan'
option device '/dev/cdc-wdm0'
option proto 'qmi'
option pdptype 'ipv4'
option auth 'none'
option apn 'iliad'
cat /etc/crontabs/root
#min hour day month day-week command
#0-59 0-23 1-31 1-12 0-6(0=Sunday) exec
* * * * * /root/wan_connect
cat /root/wan_connect
#!/bin/sh
LTEPROTO=$(cat /etc/config/network | grep "proto 'qmi'" | wc -l)
if [ ${LTEPROTO} -eq "1" ]; then
LTESTATUS=$(uqmi -d /dev/cdc-wdm0 --get-data-status | grep "\"connected\"" | wc -l)
if [ ${LTESTATUS} -eq "0" ]; then
logger "exec /root/wan_connect: lost connection detected"
logger "exec /root/wan_connect: exec ifdown wan; ifup wan"
ifdown wan
ifup wan
fi
fi
ps: the script deliberately does not reboot the interface in order to evaluate the stability of the system, as I realized that it could create "race conditions" with the automatic reconnection functionality pre-implemented by the qmi