Ask a question

1802 questions

2189 answers


1464 members

Ask a question
+1 vote
asked in Networking by
Hi There,

i log the GPS Data of the RUT955 via shell. works great!! - i'll post the script, if anybody like to use it - feel free

Now i would like to:
a) UPDATE a Geofence Location via Script if an input goes low. (Ignition of a car is switched off)
b) log the GPS Date only if the ignition is ON

is that possible? and how?!
Thanks ahead
commented by
# GPS Datei(en) werden tagesabhängig geschrieben
# Datum: 14.03.2019

# USB Mount Point

# micro SD Mount Point

# Logintervall in Sek.

while [ 1 ]; do         # Dauerschleife

# Dateiname
# Beispiel: GPS-Track-2019-03-14.csv
FILENAME=GPS-Track-$(date -Idate)
# Dateiendung

if     [ $(gpsctl -s) -eq 1 ]; then   # Wenn GPS Signal vorhanden
    if [ ! -f $FILE ]; then   # gibt es die akt. benötigte Datei? falls nicht: erzeuge diese und generiere die Überschriften
        echo -e 'Latitude;Longitude;Datetime;Altitude;Speed;Course over ground;Sat\r' > $FILE
   # Logge die GPS Positionen
    echo -e $(gpsctl -i) ';' $(gpsctl -x) ';' $(gpsctl -e) ';' $(gpsctl -a) ';' $(gpsctl -v) ';' $(gpsctl -c) ';' $(gpsctl -p)'\r' >> $FILE

# Warte die angegebene Zeitspanne


1 Answer

+2 votes
answered by


A) Do you mean the overall geofencing zone location or the unit that is in the location?

If the answer is the overall location - the script needs to edit uci configuration to update geofencing zone on your desired options as in:

Let's say we have a zone with a name "zone_name". We get "gps" uci file "geofencing" section with name "zone_name" and by gathered info update options:

  • longitude
  • latitude
But this also needs to restart the process to update the geofence location values - so it is required to restart "gps" process (look EX. 1).
If it's to update units info for geofence the only option I could think of is to restart the "gps" process as in restart the process:
(EX. 1)
/etc/init.d/gpsd restart 
However doing this wouldn't create zone check event trigger. This option is checked on unit's location change to the geofencing zone radius and as the process is rebooted it reinitialize the units location values thus to create event trigger unit's location has to be checked while the program is executing.
The reason is "gps" process gather's geofencing information only on the start of the process.

B) Do you mean the overall gps process or only the logging?

If it's overall gps process the initialization script has to be edited to also check if the ignition value has changed to start the process. Because of this the process has to be checked periodically to find out if ignition value has changed.

Initialization script is at "/etc/init.d/gpsd"

If you mean only the logging for the given example script - you only need to check the ignition state to know if it's worth to gather needed logged info from "gps" process.

C) This part is for asking via what I/O is the ignition connected that is DIGITAL1 or DIGITAL2 or ANALOG?



Best answer
commented by

To check for the I/O state: -h (SHOWS ALL THE POSSIBLE OPTIONS)


commented by
Hi Giedrius,
you helped me a lot with the - that is for getting the Ingnition status.
I will test that.

GEOFENCE - my idea is:
If the ignition stats goes to low (car/camper with the RUT955 onboeard is stopped anywhere) to update an existing geofence (let's call it: "ActualParkPosition") to get the event trigger (wich is alway on) when the RUT left the the GEOFENCE.
My plan is to put it all into the script above!

I still have now idea how to update the act. Pos. into the geofence.

Thanks ahead for a little more infos / help!