06-04-2021, 11:03 AM
(This post was last modified: 06-04-2021, 11:04 AM by 8bit.
Edit Reason: grammer
)
There's probably a better way, but you can monitor if /dev/ttyUSB0..3 exists. Those 4 serial ports disappear when the modem disconnects. Then restarting eg25-manager will bring the modem back up. It takes 30+ seconds to boot up before the serial ports will return. You can see what is happening in dmesg.
This is a simple bash script that I used. It has to run as root. It is an endless loop. You could take out the loop and the delays and run it with cron, as root. Or run it as a service.
This is a simple bash script that I used. It has to run as root. It is an endless loop. You could take out the loop and the delays and run it with cron, as root. Or run it as a service.
Code:
#!/bin/bash
FILE=/dev/ttyUSB2
while :
do
if test -c "$FILE"; then
sleep 5
else
systemctl restart eg25-manager
sleep 60
fi
done