asdf
This commit is contained in:
parent
9c5e1b8e58
commit
894007eac2
@ -14,4 +14,4 @@ RUN ./install.sh
|
|||||||
WORKDIR /opt/ttn-gateway/bin
|
WORKDIR /opt/ttn-gateway/bin
|
||||||
|
|
||||||
# Start it up
|
# Start it up
|
||||||
CMD ["sh", "-c", "env && echo && ./start.sh"]
|
CMD ["sh", "-c", "./start.sh"]
|
||||||
|
@ -14,4 +14,4 @@ RUN ./install.sh
|
|||||||
WORKDIR /opt/ttn-gateway/bin
|
WORKDIR /opt/ttn-gateway/bin
|
||||||
|
|
||||||
# Start it up
|
# Start it up
|
||||||
CMD ["sh", "-c", "pwd && ls /opt/ttn-gateway/bin && env && ./start.sh"]
|
CMD ["sh", "-c", "env && echo && ./start.sh"]
|
||||||
|
31
start.sh
31
start.sh
@ -1,8 +1,22 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Display the environment, which is useful when debugging
|
||||||
|
|
||||||
|
echo "**************************************************************"
|
||||||
|
echo "**************************************************************"
|
||||||
|
echo "Environment:"
|
||||||
|
env
|
||||||
|
echo "**************************************************************"
|
||||||
|
echo "**************************************************************"
|
||||||
|
echo ""
|
||||||
|
|
||||||
# Configure the global and local configuration files via the environment
|
# Configure the global and local configuration files via the environment
|
||||||
|
|
||||||
echo "Configuring gateway:"
|
echo "**************************************************************"
|
||||||
|
echo "**************************************************************"
|
||||||
|
echo "Gateway Configuration:"
|
||||||
|
echo "**************************************************************"
|
||||||
|
echo "**************************************************************"
|
||||||
|
|
||||||
if [[ $GATEWAY_NAME == "" ]]; then
|
if [[ $GATEWAY_NAME == "" ]]; then
|
||||||
echo "ERROR: NO GATEWAY_NAME FOUND IN ENVIRONMENT"
|
echo "ERROR: NO GATEWAY_NAME FOUND IN ENVIRONMENT"
|
||||||
@ -34,6 +48,8 @@ if [[ $GATEWAY_ALT == "" ]]; then
|
|||||||
fi
|
fi
|
||||||
echo GATEWAY_ALT: $GATEWAY_ALT
|
echo GATEWAY_ALT: $GATEWAY_ALT
|
||||||
|
|
||||||
|
echo "**************************************************************"
|
||||||
|
echo "**************************************************************"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo -e "{\n\t\"gateway_conf\": {\n\t\t\"gateway_ID\": \"0000000000000000\",\n\t\t\"servers\": [ { \"server_address\": \"croft.thethings.girovito.nl\", \"serv_port_up\": 1700, \"serv_port_down\": 1701, \"serv_enabled\": true } ],\n\t\t\"ref_latitude\": $GATEWAY_LAT,\n\t\t\"ref_longitude\": $GATEWAY_LON,\n\t\t\"ref_altitude\": $GATEWAY_ALT,\n\t\t\"contact_email\": \"$GATEWAY_EMAIL\",\n\t\t\"description\": \"$GATEWAY_NAME\" \n\t}\n}" >./local_conf.json
|
echo -e "{\n\t\"gateway_conf\": {\n\t\t\"gateway_ID\": \"0000000000000000\",\n\t\t\"servers\": [ { \"server_address\": \"croft.thethings.girovito.nl\", \"serv_port_up\": 1700, \"serv_port_down\": 1701, \"serv_enabled\": true } ],\n\t\t\"ref_latitude\": $GATEWAY_LAT,\n\t\t\"ref_longitude\": $GATEWAY_LON,\n\t\t\"ref_altitude\": $GATEWAY_ALT,\n\t\t\"contact_email\": \"$GATEWAY_EMAIL\",\n\t\t\"description\": \"$GATEWAY_NAME\" \n\t}\n}" >./local_conf.json
|
||||||
@ -41,6 +57,15 @@ echo -e "{\n\t\"gateway_conf\": {\n\t\t\"gateway_ID\": \"0000000000000000\",\n\t
|
|||||||
# Reset gateway ID based on MAC
|
# Reset gateway ID based on MAC
|
||||||
../packet_forwarder/reset_pkt_fwd.sh start ./local_conf.json
|
../packet_forwarder/reset_pkt_fwd.sh start ./local_conf.json
|
||||||
|
|
||||||
|
# Display gateway ID, which is very important for debugging
|
||||||
|
|
||||||
|
echo "**************************************************************"
|
||||||
|
echo "**************************************************************"
|
||||||
|
grep gateway_ID local_conf.json
|
||||||
|
echo "**************************************************************"
|
||||||
|
echo "**************************************************************"
|
||||||
|
echo ""
|
||||||
|
|
||||||
# Test the connection, wait if needed.
|
# Test the connection, wait if needed.
|
||||||
while [[ $(ping -c1 google.com 2>&1 | grep " 0% packet loss") == "" ]]; do
|
while [[ $(ping -c1 google.com 2>&1 | grep " 0% packet loss") == "" ]]; do
|
||||||
echo "[TTN Gateway]: Waiting for internet connection..."
|
echo "[TTN Gateway]: Waiting for internet connection..."
|
||||||
@ -52,6 +77,10 @@ while true
|
|||||||
do
|
do
|
||||||
echo "[TTN Gateway]: Starting packet forwarder..."
|
echo "[TTN Gateway]: Starting packet forwarder..."
|
||||||
./poly_pkt_fwd
|
./poly_pkt_fwd
|
||||||
|
echo "**************************************************************"
|
||||||
|
echo "**************************************************************"
|
||||||
echo "[TTN Gateway]: Packet forwarder exited; retrying in 15s..."
|
echo "[TTN Gateway]: Packet forwarder exited; retrying in 15s..."
|
||||||
|
echo "**************************************************************"
|
||||||
|
echo "**************************************************************"
|
||||||
sleep 15
|
sleep 15
|
||||||
done
|
done
|
||||||
|
@ -36,10 +36,10 @@ echo GATEWAY_ALT: $GATEWAY_ALT
|
|||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo -e "{\n\t\"gateway_conf\": {\n\t\t\"gateway_ID\": \"0000000000000000\",\n\t\t\"servers\": [ { \"server_address\": \"croft.thethings.girovito.nl\", \"serv_port_up\": 1700, \"serv_port_down\": 1701, \"serv_enabled\": true } ],\n\t\t\"ref_latitude\": $GATEWAY_LAT,\n\t\t\"ref_longitude\": $GATEWAY_LON,\n\t\t\"ref_altitude\": $GATEWAY_ALT,\n\t\t\"contact_email\": \"$GATEWAY_EMAIL\",\n\t\t\"description\": \"$GATEWAY_NAME\" \n\t}\n}" >./bin/local_conf.json
|
echo -e "{\n\t\"gateway_conf\": {\n\t\t\"gateway_ID\": \"0000000000000000\",\n\t\t\"servers\": [ { \"server_address\": \"croft.thethings.girovito.nl\", \"serv_port_up\": 1700, \"serv_port_down\": 1701, \"serv_enabled\": true } ],\n\t\t\"ref_latitude\": $GATEWAY_LAT,\n\t\t\"ref_longitude\": $GATEWAY_LON,\n\t\t\"ref_altitude\": $GATEWAY_ALT,\n\t\t\"contact_email\": \"$GATEWAY_EMAIL\",\n\t\t\"description\": \"$GATEWAY_NAME\" \n\t}\n}" >./local_conf.json
|
||||||
|
|
||||||
# Reset gateway ID based on MAC
|
# Reset gateway ID based on MAC
|
||||||
./packet_forwarder/reset_pkt_fwd.sh start ./bin/local_conf.json
|
../packet_forwarder/reset_pkt_fwd.sh start ./local_conf.json
|
||||||
|
|
||||||
# Test the connection, wait if needed.
|
# Test the connection, wait if needed.
|
||||||
while [[ $(ping -c1 google.com 2>&1 | grep " 0% packet loss") == "" ]]; do
|
while [[ $(ping -c1 google.com 2>&1 | grep " 0% packet loss") == "" ]]; do
|
||||||
|
Loading…
Reference in New Issue
Block a user