diff --git a/run.sh b/run.sh index 6745fa9..771258c 100755 --- a/run.sh +++ b/run.sh @@ -1,5 +1,12 @@ #! /bin/bash +# We need to be online, 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 + # Ensure that we've got the required env vars echo "*******************" @@ -160,13 +167,6 @@ sleep 0.1 gpio -1 write 22 0 sleep 0.1 -# 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. while true