Start mobile data if not available
For some reason, mobile data drops and must be restarted manually. From own experience, it seems to occur frequently during phone calls.
This commit is contained in:
parent
1ed167f237
commit
925e01271b
|
@ -9,6 +9,15 @@ is_modem_available()
|
|||
return 0
|
||||
}
|
||||
|
||||
is_data_available()
|
||||
{
|
||||
if ! nmcli c show --active | grep -e internet -e gsm > /dev/null; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
TRY=0
|
||||
while :; do
|
||||
if ! is_modem_available ; then
|
||||
|
@ -19,6 +28,10 @@ while :; do
|
|||
elif [ $TRY -ne 0 ]; then
|
||||
echo $(date): Modem restarted successfully
|
||||
TRY=0
|
||||
elif ! is_data_available; then
|
||||
echo $(date): Restarting mobile data
|
||||
nmcli c up internet
|
||||
systemd-inhibit --what=sleep --why="Restart mobile data" sleep 5
|
||||
fi
|
||||
|
||||
sleep 30
|
||||
|
|
Loading…
Reference in New Issue