QMI Reconnect issues

Hello, I was wondering if anyone can help with the QMI auto connect script. I have downloaded the auto connect script and ran the install. When checking the status of the qmi_service I receive ‘Failed to start QMI Auto Connection’. I have changed the /usr/src/qmi_reconnect.sh script to the following

#!/bin/sh

while true; do
    ping -I wwan0 -c 8.8.8.8
    if [ $? -eq 0); then
        echo "Connection up, reconnect not required..."
   else
        echo "Connection down, reconnecting..."
        cd /home/xxx/files/
       sudo ./quectel-CM -s wireless,twilio.com -f twilio.log
    f1

    sleep 1
done

I have the quectel-CM directory located in /home/xxx/files/

If I ran the the usr/src/qmi_reconnect.sh from the CLI the script works. Any idea on how to fix this?

Hi @matt.klabacka,

Change the /usr/src/qmi reconnect.sh script to the following:

#!/bin/sh

while true; do

    ping -I wwan0 -c 8.8.8.8

    if [ $? -eq 0); then
         echo "Connection up, reconnect not required..."
    else
         echo "Connection down, reconnecting..."
         sudo /home/xxx/files/quectel-CM/quectel-CM -s wireless,twilio.com -f twilio.log
    fi

    sleep 10
done

Hi ensar! Thank you for the quick response. I have updated the qmi_reconnect.sh script as you mentioned. The script runs fine but the service still fails.

ExecStart=/bin/sh /user/src/qmi_reconnect.sh (code=exited, status=200/CHDIR).

Any thoughts?

Hi ensar. I have it working now. Here’s what I had to do

  1. Change the WorkingDirectory path in the /etc/systemd/system/qmi_reconnect.service file. It was /home/pi/files. I removed the pi user during my initial config of the RPi.

  2. systemctl daemon-reload

  3. systemctl start qmi_reconnect.service

  4. systemcrl enable qmi_reconnect.service

Hi,
Thanks for your updating. I am glad to hear that you have figured out your issue. :+1:
Thanks!

The is some permission issue with folder “quectel-CM”
I have to change folder permission to 777 for the auto connect script to run.