pinephone drops cellular network
#17
(08-26-2021, 09:52 AM)3Gluddite Wrote:
(07-25-2021, 04:47 PM)ragreenburg Wrote: What would a script like that look like?

Sorry no one helped you at the time, but here's a thread with examples: https://forum.pine64.org/showthread.php?tid=14099

And here's a slightly modified/excessively commented version that I made a few days ago. You'll need to change the path of the logfile to something that makes sense for your setup, of course.

Code:
#!/bin/bash

sleep 30s #Gives modem time to boot (in case this is run at startup)
modem=/dev/ttyUSB2 #Defines a variable representing the modem's USB connection

while : #Infinite loop
do
if test -c "$modem"; then #If the modem is accessible
  sleep 15s
  else #If the modem is inaccessible
  echo "Modem disconnected at" $(date -u) >> /home/alarm/Scripts/ModemSentinel.log #Prints GMT timestamped message to the logfile
  systemctl stop eg25-manager
  sleep 15s #Instantly restarting eg25-manager doesn't always work
  systemctl start eg25-manager
  sleep 40s #Modem takes a while to wake up
  if test ! -c "$modem"; then #If the modem is still not visible
    echo "Modem reconnection failed; rebooting system." >> /home/alarm/Scripts/ModSent.log #Record failure to the logfile
    shutdown -r now #Reboot. If you're using Megi's multiboot image, reboots will get stuck at the boot menu. To avoid this, go to the boot menu, select your primary OS, and hold down the power button. This will make it so you boot directly to your primary OS, but the boot menu can still be accessed by holding volume down while turning the Pinephone on.
    else
    echo "Modem reconnected successfully." >> /home/alarm/Scripts/ModemSentinel.log #Record success to the logfile
  fi
fi
done

Thank you for this!
  Reply


Messages In This Thread
pinephone drops cellular network - by Rainer - 05-12-2021, 08:52 AM
RE: pinephone drops cellular network - by Rainer - 05-13-2021, 09:02 AM
RE: pinephone drops cellular network - by rushop - 05-29-2021, 12:45 AM
RE: pinephone drops cellular network - by mouffa - 05-26-2021, 05:05 AM
RE: pinephone drops cellular network - by mudflap - 05-31-2021, 07:32 PM
RE: pinephone drops cellular network - by mouffa - 05-31-2021, 03:42 AM
RE: pinephone drops cellular network - by Line - 07-07-2021, 10:12 AM
RE: pinephone drops cellular network - by mouffa - 07-08-2021, 06:43 AM
RE: pinephone drops cellular network - by mouffa - 07-25-2021, 04:54 PM
RE: pinephone drops cellular network - by ragreenburg - 08-26-2021, 01:56 PM
RE: pinephone drops cellular network - by eoj - 09-08-2021, 04:22 PM
RE: pinephone drops cellular network - by goku499 - 09-13-2021, 04:28 AM
RE: pinephone drops cellular network - by goku499 - 09-14-2021, 02:00 PM
RE: pinephone drops cellular network - by bcnaz - 09-14-2021, 02:04 PM
RE: pinephone drops cellular network - by goku499 - 09-14-2021, 02:05 PM
RE: pinephone drops cellular network - by bcnaz - 09-14-2021, 03:11 PM
RE: pinephone drops cellular network - by goku499 - 09-14-2021, 04:03 PM
RE: pinephone drops cellular network - by bcnaz - 09-14-2021, 04:16 PM
RE: pinephone drops cellular network - by bcnaz - 09-17-2021, 03:49 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Sad PinePhone USB-C port and audio jack failure Kevin Kofler 2 470 07-09-2025, 02:04 PM
Last Post: georgegohl888
  Modem Issues with the Pinephone Temmie19 5 1,727 07-02-2025, 12:50 PM
Last Post: biketool
Question Third-party cheap touchscreen/LCD for the Pinephone - lost knowledge? mikeb 2 1,144 06-21-2025, 05:19 PM
Last Post: mikeb
  Pinephone + Keyboard for sale, little use ruemoo 9 2,929 06-10-2025, 09:25 PM
Last Post: skaffi
  Pinephone not booting sd card... bruv 1 769 03-25-2025, 08:51 PM
Last Post: Kevin Kofler
  Pinephone - broken power button rorus 13 14,710 12-16-2024, 08:32 PM
Last Post: tllim
  various tricks to open the pinephone shengchieh 3 2,479 09-16-2024, 03:42 AM
Last Post: biketool
  my pinephone melted norayr 6 3,701 04-04-2024, 07:22 PM
Last Post: Zebulon Walton
  Pinephone refusing to charge while suspended tiol 1 2,357 04-02-2024, 10:54 AM
Last Post: joH_N_Doe64
  pinephone can provide more than 500mA to a usb-c displayport device? unrznbl 2 1,955 03-21-2024, 08:52 AM
Last Post: unrznbl

Forum Jump:


Users browsing this thread: 1 Guest(s)