wpj428/files/usr/sbin/wwan_reconnect

19 lines
665 B
Text
Raw Normal View History

2021-03-23 12:38:36 +00:00
#!/bin/sh
MODEM_STATE=$(mmcli --modem 0 --output-keyvalue|grep "modem.generic.state"|grep -o "\w*$")
BEARER=$(mmcli --modem 0 --output-keyvalue|grep 'modem.generic.bearers.value\[1\]'|grep -o '\d*$')
BEARER_CONNECTED=$(mmcli -b $BEARER --output-keyvalue|grep bearer.status.connected|grep -o "\w*$")
echo "(modem state: $MODEM_STATE, bearer connected: $BEARER_CONNECTED, bearer id: $BEARER)"
if [[ $MODEM_STATE == 'registered' ]] ; then
echo "trigger simple-connect"
ifup broadband
sleep 600 # prevent loops
elif [[ $MODEM_STATE == 'disabled' ]] ; then
echo "trigger simple-connect"
ifup broadband
sleep 600 # prevent loops
2021-03-23 12:38:36 +00:00
else
echo "do nothing"
fi