2021-12-14, 01:29 PM
To all,
I have found a work around ; please fell free to comment as it is certainly not the most appropriate.
Idea:
* Use local GPSD daemon on openplotter to retrieve the GPS (and potential AIS data) so that the connection to GPSD is never lost.
* Concern : what happen if local GPSD loose the link to GPSD running tinycore
* Solution : small batch called by systemd for keepalive (systemd rather than
Starting the services (in root):
I have found a work around ; please fell free to comment as it is certainly not the most appropriate.
Idea:
* Use local GPSD daemon on openplotter to retrieve the GPS (and potential AIS data) so that the connection to GPSD is never lost.
* Concern : what happen if local GPSD loose the link to GPSD running tinycore
* Solution : small batch called by systemd for keepalive (systemd rather than
Code:
/home/pi/gpsd_keepalive
#!/bin/bash
# GPSD Keep Alive
# Initiate a connection to remote GPSD and ensure this connection stay alive
# XT211214
# Variables
SOURCE=gpsd://192.168.20.199:2947
# Script
gpsdevices=`gpspipe -r -n 2 | sed -e '$!d' -e 's/.*\[\([^]]*\)\].*/\1/g'`
#echo $gpsdevices
if [ -n "$gpsdevices" ] && [[ "$gpsdevices" =~ "$SOURCE" ]]; then
#echo "OK"
true
else
#echo "Missing $SOURCE"
# Missing source
/usr/sbin/gpsdctl remove "$SOURCE"
/usr/sbin/gpsdctl add "$SOURCE"
fi
Code:
/etc/systemd/system/gpsd_keepalive.timer
[Unit]
Description=Timer for GPSD KeepAlive (to cope with GPSD via networks breaks)
[Timer]
OnBootSec=30s
OnUnitInactiveSec=5s
AccuracySec=1s
[Install]
WantedBy=timers.target
Code:
/etc/systemd/system/gpsd_keepalive.service
[Unit]
Description=GPSD Keep Alive (to cope with GPSD via networks breaks)
#Documentation=
After=network.target
[Service]
WorkingDirectory=/home/pi
User=root
ExecStart=/home/pi/gpsd_keepalive
- systemctl start gpsd_keepalive.timer gpsd.keepalive.service