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
|
2021-08-21 12:39:51 +00:00
|
|
|
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
|