Sixfab_PPP_Installer/ppp_installer/reconnect_gprsshield

27 lines
366 B
Plaintext
Raw Normal View History

2018-10-15 14:58:48 +00:00
#!/bin/sh
gpio -g mode 19 in
gpio -g mode 26 out
while true; do
if [ $(gpio -g read 19) = "0" ]; then
echo "Power up"
gpio -g write 26 0
gpio -g write 26 1
sleep 2
gpio -g write 26 0
sleep 2
else
2019-07-31 21:53:04 +00:00
ping -q -I ppp0 -c 1 8.8.8.8 -s 0 >/dev/null
2018-10-15 14:58:48 +00:00
2019-07-31 21:53:04 +00:00
if [ $? -ne 0 ]; then
2018-10-15 14:58:48 +00:00
echo "Connection down, reconnecting..."
sudo pon
fi
fi
sleep 10
2018-10-15 14:58:48 +00:00
done