From 597e3006d836a4de392625c55dc658294805902e Mon Sep 17 00:00:00 2001 From: Ray Ozzie Date: Mon, 28 Mar 2016 19:48:33 -0400 Subject: [PATCH] Moved online connection check --- run.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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