ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/mports/trunk/astro/gpsd/files/gpsd.in
Revision: 20757
Committed: Fri Nov 13 01:03:59 2015 UTC (8 years, 5 months ago) by laffer1
File size: 1498 byte(s)
Log Message:
 update to 3.14

File Contents

# Content
1 #!/bin/sh
2 #
3 # $FreeBSD: head/astro/gpsd/files/gpsd.in 340851 2014-01-23 19:55:14Z mat $
4 #
5
6 # PROVIDE: gpsd
7 # REQUIRE: NETWORKING DAEMON cleanvar devfs
8 # BEFORE: ntpd
9 # KEYWORD: shutdown
10
11 #
12 # Add the following lines to /etc/rc.conf to enable gpsd:
13 #
14 # gpsd_enable (bool): Set to "NO" by default.
15 # Set it to "YES" to enable gpsd.
16 #
17 # gpsd_flags (str): Set to "" by default.
18 # See gpsd(8) for flags.
19 #
20 # gpsd_devices (str): Set to "" by default.
21 # Example: "/dev/cuaU0" for a USB serial GPS.
22 #
23
24 . /etc/rc.subr
25
26 name=gpsd
27 rcvar=gpsd_enable
28
29 start_postcmd=start_postcmd
30 stop_postcmd=stop_postcmd
31
32 start_postcmd()
33 {
34 if ! checkyesno gpxlogger_enable; then
35 return;
36 fi
37
38 cd ${gpxlogger_logdir};
39 gpx=$(date +"${gpxlogger_format}")
40 touch "${pidfile_logger}" "${gpx}"
41 chown nobody:nobody "${pidfile_logger}" "${gpx}"
42 /usr/sbin/daemon -u nobody -p "${pidfile_logger}" \
43 ${gpxlogger} ${gpxlogger_flags} > ${gpx}
44 }
45
46 stop_postcmd()
47 {
48 if ! checkyesno gpxlogger_enable; then
49 return;
50 fi
51
52 /bin/kill $(/bin/cat "${pidfile_logger}")
53 }
54
55 load_rc_config $name
56
57 # Set defaults
58 : ${gpsd_enable:="NO"}
59 : ${gpxlogger_enable:="NO"}
60 : ${gpxlogger_flags:="-i 600"}
61 : ${gpxlogger_logdir:="/var/log"}
62 : ${gpxlogger_format:="%d %B %Y - %H:%M.gpx"}
63
64 pidfile=/var/run/$name.pid
65 command=%%PREFIX%%/sbin/$name
66 command_args="-P $pidfile $gpsd_devices"
67
68 gpxlogger=/usr/local/bin/gpxlogger
69 pidfile_logger=/var/run/gpxlogger.pid
70
71 run_rc_command "$1"