summaryrefslogtreecommitdiff
path: root/astro/gpxloggerd/files/gpxloggerd.in
blob: d3874cfb2d45368370bf273acf899359026cfc7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: gpxloggerd
# REQUIRE: NETWORKING DAEMON cleanvar devfs gpsd
# BEFORE:  ntpd
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable gpxloggerd:
#
# gpxloggerd_enable (bool):	Set to "NO" by default.
#				Set it to "YES" to enable gpxloggerd.
#
# gpxloggerd_host (str):	Set to "" by default, which is equal
#				to "localhost:2947".
#				Set to host:port if gpsd is not local.
#
# gpxloggerd_flags (str):	Set to "-d" by default.
#
# gpxloggerd_template (str):	Set to "/var/log/%d %B %Y - %H:%M.gpx"
#				by default.
#				
#				See gpxloggerd(8) for more info.

. /etc/rc.subr

name=gpxloggerd
rcvar=gpxloggerd_enable

load_rc_config $name

# Set defaults
template="${gpxloggerd_template:-/var/log/%d %B %Y - %H:%M.gpx}"
user="${gpxloggerd_user:-nobody}"
group="${gpxloggerd_group:-nobody}"
pidfile=/var/run/$name.pid

command=%%PREFIX%%/sbin/$name
command_args="-u ${user}:${group} -p ${pidfile} -f \"${template}\" $gpxloggerd_host"

run_rc_command "$1"