gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fw: gpsd | gpsd fails to reconnect to tcp:// feeds (#64)


From: Gary E. Miller
Subject: Fw: gpsd | gpsd fails to reconnect to tcp:// feeds (#64)
Date: Fri, 1 May 2020 16:42:31 -0700

Yo All!

Alan Eneev forwarded me his solution to having gpsd reconnect to
a tcp:// source when it drops.  Nice.  Maybe others can use it.

See below.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin


Date: Fri, 01 May 2020 22:55:42 +0000
From: Alan Eneev <address@hidden>
Subject: Re: gpsd | gpsd fails to reconnect to tcp:// feeds (#64)


Alan Eneev commented:


Happy to share! Here is our systemd unit config: 

[Unit]
# This unit is needed to shield gpsd from GPS device restarts. It
# forwards connections from gpsd to GPS device. If either end of the
# connection fails, socat will terminate, and systemd will restart
# socat. GPSd also depends on this service, so systemd will restart
# gpsd as well.
# Socat listen on 0.0.0.0:44444 and "forwards" to 192.168.1.100:44444. 
Description=TCP connection relay for GPSd

# Start this before GPSd, and after we're online.
Before=gpsd.service
After=network-online.target

[Service]
# Summary of used flags:
#   -T3        inactivity timeout (3 seconds). GPS devices are supposed
#              to be very  chatty, so 3 second silence warrants a
#              restart.
#   -ly        log to systemd
#   -U         unidirectional mode -- write into the first address,
#              from the second address 
#   -d -d      more verbose logs
#   connect-timeout=5
#              This option for the second address means that socat will
#              exit with an error if it fails to establish connection
#              within specified timeout (seconds).
#              This means if we fail to establish connection with GPS
#              device within 5 seconds, socat will exit, and systemd
@ will retry it.
ExecStart=/usr/bin/socat -T3 -ly -U -d -d TCP-LISTEN:44444 
TCP:192.168.1.100:44444,connect-timeout=5
PermissionsStartOnly=true TimeoutSec=2
Restart=always

[Install]
# Make this a dependency of GPSd. Required to restart GPSd when this
# unit terminates.
RequiredBy=gpsd.service


RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Alan Eneev commented:

Happy to share! Here is our systemd unit config:

[Unit]
# This unit is needed to shield gpsd from GPS device restarts. It forwards
# connections from gpsd to GPS device. If either end of the connection fails,
# socat will terminate, and systemd will restart socat. GPSd also depends on
# this service, so systemd will restart gpsd as well.
#
# Socat listen on 0.0.0.0:44444 and "forwards" to 192.168.1.100:44444. 
Description=TCP connection relay for GPSd

# Start this before GPSd, and after we're online.
Before=gpsd.service
After=network-online.target

[Service]
# Summary of used flags:
#   -T3        inactivity timeout (3 seconds). GPS devices are supposed to be very
#              chatty, so 3 second silence warrants a restart.
#   -ly        log to systemd
#   -U         unidirectional mode -- write into the first address, from the second address
#   -d -d      more verbose logs
#   connect-timeout=5
#              This option for the second address means that socat will exit
#              with an error if it fails to establish connection within
#              specified timeout (seconds).
#              This means if we fail to establish connection with GPS device
#              within 5 seconds, socat will exit, and systemd will retry it.
ExecStart=/usr/bin/socat -T3 -ly -U -d -d TCP-LISTEN:44444 TCP:192.168.1.100:44444,connect-timeout=5
PermissionsStartOnly=true
TimeoutSec=2
Restart=always

[Install]
# Make this a dependency of GPSd. Required to restart GPSd when this unit terminates.
RequiredBy=gpsd.service

Attachment: pgpZEd4cZbVeO.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]