2016-03-21 19:36:55 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
2016-03-21 21:20:50 +00:00
|
|
|
# Reset gateway ID based on MAC
|
|
|
|
./packet_forwarder/reset_pkt_fwd.sh start ./bin/local_conf.json
|
|
|
|
|
2016-03-21 19:36:55 +00:00
|
|
|
# Test the connection, wait if needed.
|
|
|
|
while [[ $(ping -c1 google.com 2>&1 | grep " 0% packet loss") == "" ]]; do
|
|
|
|
echo "[TTN Gateway]: Waiting for internet connection..."
|
|
|
|
sleep 30
|
|
|
|
done
|
|
|
|
|
|
|
|
# Fire up the forwarder.
|
2016-03-21 21:20:50 +00:00
|
|
|
while true
|
|
|
|
do
|
|
|
|
echo "[TTN Gateway]: Starting packet forwarder..."
|
|
|
|
./poly_pkt_fwd
|
|
|
|
echo "[TTN Gateway]: Packet forwarder exited; retrying in 15s..."
|
|
|
|
sleep 15
|
|
|
|
done
|