add install scripts and move secrets to uncommited file

This commit is contained in:
grizzly 2025-07-12 12:19:35 -04:00
parent 963907fcf4
commit 2fbec4da69
6 changed files with 60 additions and 0 deletions

View file

@ -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