diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-03-06 00:17:32 +0100 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-03-06 00:18:50 +0100 |
| commit | 925e01271b362038e8445950db4aa902ec4d7dd6 (patch) | |
| tree | f42d85282f97f1a386d1004ba3e9bfc94017228b | |
| parent | 1ed167f237fbc54c6383f75732dbde7db06df9a2 (diff) | |
For some reason, mobile data drops and must be restarted manually. From
own experience, it seems to occur frequently during phone calls.
| -rwxr-xr-x | modem-restart | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/modem-restart b/modem-restart index 2734705..93de004 100755 --- a/modem-restart +++ b/modem-restart @@ -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 |
