Fixed network reg. problem on ppp_connection_manager

This commit is contained in:
Yasin Kaya 2020-11-26 12:59:34 +00:00
parent 763b8c6802
commit e0c6edf847
4 changed files with 13 additions and 13 deletions

View File

@ -3,4 +3,4 @@
INTERVAL=60 # Seconds, Interval between two connection check of internet
DOUBLE_CHECK_WAIT=10 # Seconds, wait time for double check when the connection is down
PING_TIMEOUT=9 # Seconds, Timeout of ping command
NETWORK_CHECK_TIMEOUT=300 # Count, Check network for ($NETWORK_TIMEOUT x 2 Seconds)
NETWORK_CHECK_TIMEOUT=150 # Count, Check network for ($NETWORK_TIMEOUT x 2 Seconds)

View File

@ -52,7 +52,7 @@ else
fi
### Modem configuration for RMNET/PPP mode ##################################
debug "Checking APN and Modem Mode..."
debug "Checking APN and Modem Modem..."
# APN Configuration
# -----------------
@ -177,5 +177,5 @@ fi
# Check the network is ready
# --------------------------
if check_network -eq 0; then exit 0; else debug "Network registeration is failed!"; exit 1; fi
if check_network -eq 0; then exit 0; else debug "Network registeration is failed!. Modem configuration is unsuccesfully ended!"; exit 1; fi

View File

@ -21,7 +21,7 @@ function check_network()
# Check the network is ready
debug "Checking the network is ready..."
for i in {1..$NETWORK_CHECK_TIMEOUT}; do
for n in $(seq 1 $NETWORK_CHECK_TIMEOUT); do
NETWORK_OK=0
debug "SIM Status: " "-n" # no line break
@ -32,17 +32,18 @@ function check_network()
debug "Network Registeration Status: " "-n" # no line break
NR_TEXT=`atcom AT+CREG? | grep "CREG:"`
echo $NR_TEXT
# For super SIM
atcom AT+CREG? | grep "CREG: 0,5" > /dev/null
echo $NR_TEXT | grep "CREG: 0,5" > /dev/null
NETWORK_REG=$?
# For native SIM
atcom AT+CREG? | grep "CREG: 0,1" > /dev/null
echo $NR_TEXT | grep "CREG: 0,1" > /dev/null
NETWORK_REG_2=$?
# Combined network registeration status
NETWORK_REG=$((NETWORK_REG+NETWORK_REG_2))
if [[ $NETWORK_REG -ne 0 ]] || [[ $NETWORK_REG_2 -ne 0 ]]; then atcom AT+CREG? | grep "CREG:"; fi
if [[ $SIM_READY -eq 0 ]] && [[ $NETWORK_REG -le 1 ]]; then
debug "Network is ready."
NETWORK_OK=1
@ -53,6 +54,6 @@ function check_network()
fi
sleep 2
done
debug "Retwork registeration is failed! Please check SIM card, data plan, antennas etc."
debug "Network registeration is failed! Please check SIM card, data plan, antennas etc."
return 1
}

View File

@ -12,14 +12,13 @@ else
debug "Log folder is created."
fi
for i in {1..120}; do
for i in {1..4}; do
bash configure_modem.sh |& sudo tee -a ./logs/$LOG_FILE_NAME.log
MODEM_CONFIG=$?
MODEM_CONFIG=${PIPESTATUS[0]} # compatible with only bash
if [[ $MODEM_CONFIG -eq 0 ]]; then
break
fi
sleep 1
done
@ -27,6 +26,6 @@ if [[ $MODEM_CONFIG -eq 0 ]]; then
bash ppp_reconnect.sh |& sudo tee -a ./logs/$LOG_FILE_NAME.log
else
debug "Modem configuration is failed multiple times!"
debug "Checkout other troubleshooting step on docs.sixfab.com."
debug "Checkout other troubleshooting steps on docs.sixfab.com."
exit 1
fi