2016-03-21 12:36:55 -07:00
|
|
|
#! /bin/bash
|
|
|
|
|
2016-03-21 14:20:50 -07:00
|
|
|
# Reset gateway ID based on MAC
|
|
|
|
./packet_forwarder/reset_pkt_fwd.sh start ./bin/local_conf.json
|
|
|
|
|
2016-03-21 12:36:55 -07: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 14:20:50 -07: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
|