From 4809540e001487c8987745f69711b138631c676e Mon Sep 17 00:00:00 2001 From: "Wile E. Coyote" Date: Fri, 5 May 2017 08:11:51 +0000 Subject: [PATCH] Add script to get GPS coords --- modules/rhizo_base/files/bin/get_position.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 modules/rhizo_base/files/bin/get_position.sh diff --git a/modules/rhizo_base/files/bin/get_position.sh b/modules/rhizo_base/files/bin/get_position.sh new file mode 100755 index 0000000..74bfc78 --- /dev/null +++ b/modules/rhizo_base/files/bin/get_position.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Get Position from each BTS, from BTS1 up to BTS3 +RHIZO_SCRIPT="/home/rhizomatica/bin" +. $RHIZO_SCRIPT/vars.sh +n=0 +for bts in $BTS1 $BTS2 $BTS3; do + echo "BTS $bts:"; + let "n++" + #ssh root@$bts "/etc/init.d/gpsd stop ; sleep 1 ;/etc/init.d/gpsd start; sleep 1" + TPV="$( ssh root@$bts "gpspipe -w | head -10 | grep TPV" | head -1 )" + #echo $TPV + LAT="$( echo $TPV | sed -r 's/.*"lat":([^,]*)\,.*"lon":([^,]*),.*"alt":([^}]*).*/\1/' )" + LON="$( echo $TPV | sed -r 's/.*"lat":([^,]*)\,.*"lon":([^,]*),.*"alt":([^}]*).*/\2/' )" + ALT="$( echo $TPV | sed -r 's/.*"lat":([^,]*)\,.*"lon":([^,]*),.*"alt":([^}]*).*/\3/' )" + eval LAT_$n=$LAT + eval LON_$n=$LON + eval ALT_$n=$ALT + echo $LAT $LON $ALT +done +