Added checking ppp is default route to service scripts

This commit is contained in:
Yasin Kaya 2020-11-26 13:51:56 +00:00
parent e0c6edf847
commit 0f93aaa4a1
7 changed files with 61 additions and 37 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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