mirror of
https://github.com/sixfab/Sixfab_PPP_Installer
synced 2024-12-23 17:57:36 +00:00
reconnect script added for Tracker HAT
This commit is contained in:
parent
b9eafdc3f6
commit
7758c58028
30
ppp_installer/reconnect_tracker
Normal file
30
ppp_installer/reconnect_tracker
Normal file
@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
gpio -g mode 23 in #status
|
||||
gpio -g mode 24 out #powerkey
|
||||
gpio -g mode 17 out #disable
|
||||
# enabling the power of the HAT
|
||||
gpio -g write 17 1
|
||||
sleep 1
|
||||
gpio -g write 17 0
|
||||
|
||||
while true; do
|
||||
|
||||
if [ $(gpio -g read 23) = "0" ]; then
|
||||
echo "Power up"
|
||||
|
||||
gpio -g write 24 1
|
||||
sleep 2
|
||||
gpio -g write 24 0
|
||||
sleep 2
|
||||
else
|
||||
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
|
||||
fi
|
||||
|
||||
sleep 10
|
||||
done
|
Loading…
Reference in New Issue
Block a user