mirror of
https://github.com/sixfab/Sixfab_PPP_Installer
synced 2024-12-27 03:31:36 +00:00
0ba07617f0
ii. Pings Header only to save data.
34 lines
477 B
Bash
34 lines
477 B
Bash
#!/bin/sh
|
|
|
|
gpio -g mode 20 in
|
|
gpio -g mode 11 out
|
|
gpio -g mode 26 out
|
|
|
|
gpio -g write 26 0
|
|
sleep 1
|
|
gpio -g write 26 1
|
|
|
|
while true; do
|
|
|
|
if [ $(gpio -g read 20) = "1" ]; then
|
|
echo "Power up"
|
|
|
|
gpio -g write 11 0
|
|
gpio -g write 11 1
|
|
sleep 2
|
|
gpio -g write 11 0
|
|
sleep 2
|
|
else
|
|
ping -I ppp0 -c 1 8.8.8.8 -s 0
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "Connection up, reconnect not required..."
|
|
else
|
|
echo "Connection down, reconnecting..."
|
|
sudo pon
|
|
fi
|
|
fi
|
|
|
|
sleep 10
|
|
done
|