From 289daaf859048b4c399063f27e55bf236bb7844e Mon Sep 17 00:00:00 2001 From: Manuel Palenzuela Date: Sat, 1 Jun 2019 11:59:02 +0200 Subject: Fixed service file x2 --- geolocate | 13 +++++++++++++ geolocate.service | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/geolocate b/geolocate index b11846f..674d242 100755 --- a/geolocate +++ b/geolocate @@ -35,6 +35,15 @@ curl -s https://ipvigilante.com/ | \ done } +printCoord() { +curl -s https://ipvigilante.com/ | \ + jq '.data.latitude, .data.longitude' | \ + while read -r LATITUDE; do + read -r LONGITUDE + echo "${LATITUDE}:${LONGITUDE}" | tr -d '"' > /usr/share/geolocate/.location + done +} + main() { case "$1" in @@ -65,6 +74,10 @@ curl -s https://ipvigilante.com/ | \ esac exit 0 ;; + print) + printCoord + exit 0 + ;; *) getCoord exit 0 diff --git a/geolocate.service b/geolocate.service index 2cc3cb9..6527d7e 100644 --- a/geolocate.service +++ b/geolocate.service @@ -4,7 +4,7 @@ Wants=network-online.target After=network.target network-online.target [Service] -ExecStart=/usr/bin/geolocate > /usr/share/geolocate/.location +ExecStart=/usr/bin/geolocate print [Install] WantedBy=multi-use1r.target -- cgit 1.4.1