add install scripts and move secrets to uncommited file
This commit is contained in:
parent
963907fcf4
commit
2fbec4da69
6 changed files with 60 additions and 0 deletions
19
collector.sh
19
collector.sh
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/sh
|
||||
# Collects and logs data from the OpenShipData API and the OSM API
|
||||
#
|
||||
source ./secrets
|
||||
|
|
@ -21,3 +22,21 @@ province=$(echo "$osm_response" | jq --raw-output .address.province)
|
|||
country=$(echo "$osm_response" | jq --raw-output .address.country)
|
||||
|
||||
echo "La ville la plus proche est $town dans la province de $province, $country"
|
||||
|
||||
curl -s -d "Donnees collectes" $NTFY_ENDPOINT
|
||||
|
||||
# store values in file
|
||||
if ! [ -e "$DATA_FILE" ] ; then
|
||||
touch $DATA_FILE
|
||||
echo "timestamp,latitude,longitude,bearing,speed,town,province,country" >> $DATA_FILE
|
||||
fi
|
||||
|
||||
if ! [ -w "$DATA_FILE" ] ; then
|
||||
echo "$DATA_FILE is not writeable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
timestamp=$(date)
|
||||
echo "\"$timestamp\",$lat,$lon,$bearing,$speed,\"$town\",\"$province\",\"$country\"" >> $DATA_FILE
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue