From 492f2b41f6ac191a8b811a0f6f49083ec78187c0 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sun, 12 Sep 2021 18:22:24 +0000 Subject: [PATCH] Add 'check-reboot-modem.sh' --- check-reboot-modem.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 check-reboot-modem.sh diff --git a/check-reboot-modem.sh b/check-reboot-modem.sh new file mode 100644 index 0000000..0bcb6a7 --- /dev/null +++ b/check-reboot-modem.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# A script to check the modem is still there and reboot it if not. +# From: https://www.reddit.com/r/PinePhoneOfficial/comments/pldi68/after_1_week_with_pinephone_battery_life_and_sim/hcajlhn?utm_source=share&utm_medium=web2x&context=3 + +DELAY=60 + +st=$(lsusb | grep Quectel) +if test "x$st" = "x" +then + echo "Modem not found, rechecking in $DELAY s." + sleep $DELAY + st=$(lsusb | grep Quectel) + if test "x$st" = "x" + then + echo "Modem not auto-restored by system; restarting eg25-manager." + systemctl restart eg25-manager + else + echo "Modem was auto-restored by system." + fi +fi \ No newline at end of file