mirror of
https://github.com/sixfab/Sixfab_PPP_Installer
synced 2024-12-24 10:11:36 +00:00
34 lines
498 B
Bash
34 lines
498 B
Bash
#!/bin/sh
|
|
|
|
gpio -g mode 23 in #status
|
|
gpio -g mode 24 out #powerkey
|
|
gpio -g mode 17 out #enable
|
|
|
|
gpio -g write 17 1
|
|
sleep 1
|
|
gpio -g write 17 0
|
|
|
|
while true; do
|
|
|
|
if [ $(gpio -g read 23) = "1" ]; then
|
|
echo "Power up"
|
|
|
|
#gpio -g write 24 0
|
|
gpio -g write 24 1
|
|
sleep 2
|
|
gpio -g write 24 0
|
|
sleep 2
|
|
else
|
|
ping -I ppp0 -c 1 8.8.8.8
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "Connection up, reconnect not required..."
|
|
else
|
|
echo "Connection down, reconnecting..."
|
|
sudo pon
|
|
fi
|
|
fi
|
|
|
|
sleep 1
|
|
done
|