mirror of
https://github.com/sixfab/Sixfab_PPP_Installer
synced 2024-11-22 02:54:53 +00:00
Added template of connection_manager scripts
This commit is contained in:
parent
3c974f6dad
commit
d068380cd5
38
src/configure_modem.sh
Normal file
38
src/configure_modem.sh
Normal file
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
source functions.sh
|
||||
|
||||
### Modem configuration for RMNET/PPP mode ##################################
|
||||
debug "Checking APN and Modem Mode..."
|
||||
|
||||
# APN
|
||||
atcom "AT+CGDCONT?" "OK" "ERROR" 10 | grep super >> /dev/null
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
atcom "AT+CGDCONT=1,\"IP\",\"super\"" "OK" "ERROR" 10
|
||||
debug "APN is updated."
|
||||
fi
|
||||
|
||||
atcom "AT#USBCFG?" "OK" "ERROR" 10 | grep 0 >> /dev/null
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
atcom "AT#USBCFG=0" "OK" "ERROR" 10
|
||||
debug "RMNET/PPP mode is activated."
|
||||
debug "Modem restarting..."
|
||||
|
||||
sleep 20
|
||||
|
||||
# Check modem is started!
|
||||
for i in {1..120}; do
|
||||
route -n | grep wwan0 >> /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo
|
||||
debug "Modem is restarted."
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
printf "*"
|
||||
done
|
||||
sleep 5 # wait until modem is ready
|
||||
fi
|
||||
### End of Modem configuration for RMNET/PPP mode ############################
|
32
src/ppp_connection_manager.sh
Normal file
32
src/ppp_connection_manager.sh
Normal file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
source functions.sh
|
||||
|
||||
LOG_FOLDER="./logs"
|
||||
LOG_FILE_NAME=$(date "+%Y_%m_%d_%H:%M:%S")
|
||||
|
||||
if [[ -e $LOG_FOLDER ]]; then
|
||||
debug "Log folder already exist!"
|
||||
else
|
||||
sudo mkdir $LOG_FOLDER
|
||||
debug "Log folder is created."
|
||||
fi
|
||||
|
||||
for i in {1..120}; do
|
||||
bash configure_modem.sh |& sudo tee -a ./logs/$LOG_FILE_NAME.log
|
||||
MODEM_CONFIG=$?
|
||||
|
||||
if [[ $MODEM_CONFIG -eq 0 ]]; then
|
||||
break
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if [[ $MODEM_CONFIG -eq 0 ]]; then
|
||||
bash ./reconnect_scripts/reconnect_baseshield |& 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."
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue
Block a user