From 3f7782e949465c8ba3a3c3efb2223e7d7b9443e2 Mon Sep 17 00:00:00 2001 From: saeedjohar Date: Fri, 11 Oct 2019 23:06:29 +0300 Subject: [PATCH] BASE HAT reconnect script added --- ppp_installer/reconnect_basehat | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ppp_installer/reconnect_basehat diff --git a/ppp_installer/reconnect_basehat b/ppp_installer/reconnect_basehat new file mode 100644 index 0000000..e870673 --- /dev/null +++ b/ppp_installer/reconnect_basehat @@ -0,0 +1,21 @@ +#!/bin/sh +# /usr/src/reconnect +# for Base HAT + +gpio -g mode 26 out #HAT_POWER_OFF +gpio -g mode 19 out #W_DISABLE + +gpio -g write 26 0 +gpio -g write 19 0 + +while true; do + + ping -q -I ppp0 -c 1 8.8.8.8 -s 0 >/dev/null + + if [ $? -ne 0 ]; then + echo "Connection down, reconnecting..." + sudo pon + fi + + sleep 10 +done