2018-10-15 14:58:48 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2019-04-12 13:47:20 +00:00
|
|
|
gpio -g mode 23 in #status
|
|
|
|
gpio -g mode 24 out #powerkey
|
|
|
|
gpio -g mode 17 out #enable
|
2018-10-15 14:58:48 +00:00
|
|
|
|
2019-04-12 13:47:20 +00:00
|
|
|
gpio -g write 17 1
|
2018-10-15 14:58:48 +00:00
|
|
|
sleep 1
|
2019-04-12 13:47:20 +00:00
|
|
|
gpio -g write 17 0
|
2018-10-15 14:58:48 +00:00
|
|
|
|
|
|
|
while true; do
|
|
|
|
|
2019-04-12 14:30:38 +00:00
|
|
|
if [ $(gpio -g read 23) = "1" ]; then
|
2018-10-15 14:58:48 +00:00
|
|
|
echo "Power up"
|
|
|
|
|
2019-04-12 14:30:38 +00:00
|
|
|
#gpio -g write 24 0
|
2019-04-12 13:47:20 +00:00
|
|
|
gpio -g write 24 1
|
2018-10-15 14:58:48 +00:00
|
|
|
sleep 2
|
2019-04-12 13:47:20 +00:00
|
|
|
gpio -g write 24 0
|
2018-10-15 14:58:48 +00:00
|
|
|
sleep 2
|
|
|
|
else
|
2019-07-31 21:50:26 +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:50:26 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
2018-10-15 14:58:48 +00:00
|
|
|
echo "Connection down, reconnecting..."
|
|
|
|
sudo pon
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-06-10 16:11:54 +00:00
|
|
|
sleep 10
|
2018-10-15 14:58:48 +00:00
|
|
|
done
|