diff --git a/src/reconnect_scripts/reconnect_basehat b/src/reconnect_scripts/reconnect_basehat index df682ff..9da6c33 100644 --- a/src/reconnect_scripts/reconnect_basehat +++ b/src/reconnect_scripts/reconnect_basehat @@ -18,6 +18,11 @@ gpio -g write $W_DISABLE 0 if check_network -eq 0; then debug "PPP chatscript is starting..."; sudo pon; + + # check default interface + route | grep ppp | grep default > /dev/null + PPP_IS_DEFAULT=$? + if [[ $PPP_IS_DEFAULT -ne 0 ]]; then sudo route add default ppp0; debug "ppp0 is added as default interface manually." fi else debug "Network registeration is failed!"; fi @@ -42,6 +47,11 @@ while true; do debug "Connection is down, reconnecting..." if check_network -eq 0; then sleep 0.1; else debug "Network registeration is failed!"; fi sudo pon + + # check default interface + route | grep ppp | grep default > /dev/null + PPP_IS_DEFAULT=$? + if [[ $PPP_IS_DEFAULT -ne 0 ]]; then sudo route add default ppp0; debug "ppp0 is added as default interface manually." fi fi fi sleep $INTERVAL diff --git a/src/reconnect_scripts/reconnect_baseshield b/src/reconnect_scripts/reconnect_baseshield index 13fe285..7cd7b8c 100755 --- a/src/reconnect_scripts/reconnect_baseshield +++ b/src/reconnect_scripts/reconnect_baseshield @@ -6,6 +6,11 @@ source configs.sh if check_network -eq 0; then debug "PPP chatscript is starting..."; sudo pon; + + # check default interface + route | grep ppp | grep default > /dev/null + PPP_IS_DEFAULT=$? + if [[ $PPP_IS_DEFAULT -ne 0 ]]; then sudo route add default ppp0; debug "ppp0 is added as default interface manually." fi else debug "Network registeration is failed!"; fi @@ -30,6 +35,11 @@ while true; do debug "Connection is down, reconnecting..." if check_network -eq 0; then sleep 0.1; else debug "Network registeration is failed!"; fi sudo pon + + # check default interface + route | grep ppp | grep default > /dev/null + PPP_IS_DEFAULT=$? + if [[ $PPP_IS_DEFAULT -ne 0 ]]; then sudo route add default ppp0; debug "ppp0 is added as default interface manually." fi fi fi sleep $INTERVAL diff --git a/src/reconnect_scripts/reconnect_cellulariot b/src/reconnect_scripts/reconnect_cellulariot index dce0948..a272dec 100644 --- a/src/reconnect_scripts/reconnect_cellulariot +++ b/src/reconnect_scripts/reconnect_cellulariot @@ -59,6 +59,12 @@ if power_up_module -eq 0 ; then sleep 0.1; else debug "Module couldn't be powere if check_network -eq 0; then debug "PPP chatscript is starting..."; sudo pon; + + # check default interface + route | grep ppp | grep default > /dev/null + PPP_IS_DEFAULT=$? + if [[ $PPP_IS_DEFAULT -ne 0 ]]; then sudo route add default ppp0; debug "ppp0 is added as default interface manually." fi + else debug "Network registeration is failed!"; fi @@ -83,6 +89,11 @@ while true; do debug "Connection is down, reconnecting..." if check_network -eq 0; then sleep 0.1; else debug "Network registeration is failed!"; fi sudo pon + + # check default interface + route | grep ppp | grep default > /dev/null + PPP_IS_DEFAULT=$? + if [[ $PPP_IS_DEFAULT -ne 0 ]]; then sudo route add default ppp0; debug "ppp0 is added as default interface manually." fi fi fi sleep $INTERVAL diff --git a/src/reconnect_scripts/reconnect_cellulariot_app b/src/reconnect_scripts/reconnect_cellulariot_app index 83173c8..27100fc 100644 --- a/src/reconnect_scripts/reconnect_cellulariot_app +++ b/src/reconnect_scripts/reconnect_cellulariot_app @@ -60,6 +60,11 @@ if power_up_module -eq 0 ; then sleep 0.1; else debug "Module couldn't be powere if check_network -eq 0; then debug "PPP chatscript is starting..."; sudo pon; + + # check default interface + route | grep ppp | grep default > /dev/null + PPP_IS_DEFAULT=$? + if [[ $PPP_IS_DEFAULT -ne 0 ]]; then sudo route add default ppp0; debug "ppp0 is added as default interface manually." fi else debug "Network registeration is failed!"; fi @@ -84,6 +89,11 @@ while true; do debug "Connection is down, reconnecting..." if check_network -eq 0; then sleep 0.1; else debug "Network registeration is failed!"; fi sudo pon + + # check default interface + route | grep ppp | grep default > /dev/null + PPP_IS_DEFAULT=$? + if [[ $PPP_IS_DEFAULT -ne 0 ]]; then sudo route add default ppp0; debug "ppp0 is added as default interface manually." fi fi fi sleep $INTERVAL diff --git a/src/reconnect_scripts/reconnect_gprsshield b/src/reconnect_scripts/reconnect_gprsshield index 50fbdec..a8fdb67 100644 --- a/src/reconnect_scripts/reconnect_gprsshield +++ b/src/reconnect_scripts/reconnect_gprsshield @@ -50,6 +50,11 @@ if power_up_module -eq 0 ; then sleep 0.1; else debug "Module couldn't be powere if check_network -eq 0; then debug "PPP chatscript is starting..."; sudo pon; + + # check default interface + route | grep ppp | grep default > /dev/null + PPP_IS_DEFAULT=$? + if [[ $PPP_IS_DEFAULT -ne 0 ]]; then sudo route add default ppp0; debug "ppp0 is added as default interface manually." fi else debug "Network registeration is failed!"; fi @@ -74,6 +79,11 @@ while true; do debug "Connection is down, reconnecting..." if check_network -eq 0; then sleep 0.1; else debug "Network registeration is failed!"; fi sudo pon + + # check default interface + route | grep ppp | grep default > /dev/null + PPP_IS_DEFAULT=$? + if [[ $PPP_IS_DEFAULT -ne 0 ]]; then sudo route add default ppp0; debug "ppp0 is added as default interface manually." fi fi fi sleep $INTERVAL diff --git a/src/reconnect_scripts/reconnect_test.sh b/src/reconnect_scripts/reconnect_test.sh deleted file mode 100644 index c0a50ad..0000000 --- a/src/reconnect_scripts/reconnect_test.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -source functions.sh -source configs.sh - - -if check_network -eq 0; then - debug "PPP chatscript is starting..."; - sudo pon; -else - debug "Network registeration is failed!"; -fi - -while true; do - # Checking cellular internet connection - ping -q -c 1 -s 0 -w $PING_TIMEOUT -I ppp0 8.8.8.8 > /dev/null 2>&1 - PINGG=$? - - if [[ $PINGG -eq 0 ]]; then - printf "." - else - printf "/" - sleep $DOUBLE_CHECK_WAIT - # Checking cellular internet connection - ping -q -c 1 -s 0 -w $PING_TIMEOUT -I ppp0 8.8.8.8 > /dev/null 2>&1 - PINGG=$? - - if [[ $PINGG -eq 0 ]]; then - printf "+" - else - debug "Connection is down, reconnecting..." - if check_network -eq 0; then sleep 0.1; else debug "Network registeration is failed!"; fi - sudo pon - fi - fi - sleep $INTERVAL -done diff --git a/src/reconnect_scripts/reconnect_tracker b/src/reconnect_scripts/reconnect_tracker index 11b2300..451c4fe 100644 --- a/src/reconnect_scripts/reconnect_tracker +++ b/src/reconnect_scripts/reconnect_tracker @@ -60,6 +60,11 @@ if power_up_module -eq 0 ; then sleep 0.1; else debug "Module couldn't be powere if check_network -eq 0; then debug "PPP chatscript is starting..."; sudo pon; + + # check default interface + route | grep ppp | grep default > /dev/null + PPP_IS_DEFAULT=$? + if [[ $PPP_IS_DEFAULT -ne 0 ]]; then sudo route add default ppp0; debug "ppp0 is added as default interface manually." fi else debug "Network registeration is failed!"; fi @@ -84,6 +89,11 @@ while true; do debug "Connection is down, reconnecting..." if check_network -eq 0; then sleep 0.1; else debug "Network registeration is failed!"; fi sudo pon + + # check default interface + route | grep ppp | grep default > /dev/null + PPP_IS_DEFAULT=$? + if [[ $PPP_IS_DEFAULT -ne 0 ]]; then sudo route add default ppp0; debug "ppp0 is added as default interface manually." fi fi fi sleep $INTERVAL