gpsd-users
[Top][All Lists]
Advanced

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

[gpsd-users] Starting gpsd on boot with Raspbian Jessie?


From: Bo Berglund
Subject: [gpsd-users] Starting gpsd on boot with Raspbian Jessie?
Date: Tue, 08 Mar 2016 17:48:55 +0100

I have struggled a while getting the GPSD system up-to-date by
building from source. Results from this are described here:
http://blog.boberglund.com/Build_GPSD_from_sources.txt

Now I am thinking about how to get it running on boot.
When I started I had first installed via apt-get and modified a number
of files and such to get it going as a systemd service...
I have now realized that was a bad choice so I need to:
- Remove the gpsd from any systemd environment
- Set up a different way to start it at boot

When I was trying to get the old apt-get retrieved version running in
Jessie I modified/created the following files:
/etc/systemd/system/gpsd.service  (now removed)
/etc/systemd/system/gpsd_settty.service  (now removed)
/etc/default/gpsd    (keep this file, is gpsd reading it?)

To make gpsd run I decided to create a script file that could handle
the startup and this is what I have come up with so far:

-----------------------------
#!/bin/bash
#This script starts GPSD as a daemon.
#Arguments:
#-G to listen on all addresses rather than only localhost
#-n to start reading GPS device immediately, no wait for client
#-F to specify the control socket to use

#Configuration:
GPSDEVICE="/dev/ttyUSB1"
GPSSOCKET="/var/run/gpsd.sock"
GPSPARAMS=" -G -n"

#If it already is running then kill that instance first
echo "Killing existing instance of gpsd"
sudo killall gpsd

#Then start a new instance:
echo "Starting gpsd on $GPSDEVICE"
sudo gpsd $GPSDEVICE $GPSPARAMS -F $GPSSOCKET
-----------------------------

A problem here is that it prescribes to use ttyUSB0, but if that is
not present or a different device has snatched the name, then it will
not work when I connect a client. In my case I also have a USB serial
port, which sometimes becomes ttyUSB0.

I tried to make it try all ttyUSBx ports by removing the device
specification on the command line but it won't connect.
The /etc/default/gpsd file contains this:

START_DAEMON="true"
USBAUTO="false"
GPSD_OPTIONS="-G -n"
GPSD_SOCKET="/var/run/gpsd.sock"
DEVICES="/dev/ttyUSB1"

The only way I have been able to start gpsd now is with:
sudo gpsd /dev/ttyUSB1 -G -n -F /var/run/gpsd.sock

Now, how should I use my script to start gpsd on boot?
In MS-DOS there was an autoexec.bat file and in Windows there is the
registry where one can specify these startup processes as well as the
Start menu Startup folder.
But on Linux???


-- 
Bo Berglund
Developer in Sweden




reply via email to

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