LTE restart after a given time in the loop. 'It's Not a Bug, It's a Feature.'


#1

I am asking for ideas on how to do it. I need the modem (lte internal) to restart the connection, say every 2 hours.


#2

Depending on what you need to achieve and assuming you have the Quectel EC20 modem, you have at least three options (use them at your own risk)
All the options need cron or some other way to invoke a script every 2 hours
eg. place in the crontab (crontab -e) this:

* */2 * * * /root/lte_restarts.sh
#we need an empty line

then write a script and make it executable

touch /root/lte_restarts.sh
chmod +x /root/lte_restarts.sh

options in lte_restarts.sh

  1. Stop the Lte interface and restart it (only works if Lte interface exists)

    #brings down and up the Lte interface
    #!/bin/sh
    until ifdown Lte
    do
    sleep 5
    done
    sleep 10
    until ifup Lte
    do
    sleep 5
    done

  2. Reset the modem with usbreset (check the modem device id by issuing a usbreset command)

    #resets the modem with usbreset command
    #!/bin/sh
    until usbreset 05c6:9215
    do
    sleep 5
    done

  3. Reset the modem with AT commands (only works if /dev/ttyUSB is present)

    #resets the modem with AT commands
    #!/bin/sh
    echo -e “AT+CFUN=1,1” > /dev/ttyUSB3