summaryrefslogtreecommitdiffstats
path: root/main/gpsd/gpsd.initd
blob: 985271f41635abc01dbadee0827eb345df8713ce (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
#!/sbin/runscript
# Copyright 2012 Nathan Angelacos 

depend() {
	need net
	after firewall
	use ntp-server
}

GPS=${SVCNAME#*.}
if [ -n "${GPS}" ] && [ ${SVCNAME} != "gpsd" ]; then
   GPSPID="/var/run/gpsd.${GPS}.pid"
else
   GPSPID="/var/run/gpsd.pid"
fi

start() {

        if [ -z "${DEVICE}" ]; then
		eerror "Specify a GPS device in /etc/conf.d/${SVCNAME}" 
		return 1
        fi

	ebegin "Starting gpsd"
	start-stop-daemon --start --quiet \
		--exec /usr/sbin/gpsd \
		--  ${ARGS} -P "${GPSPID}" ${DEVICE}
	eend $? "Failed to start gpsd"
}

stop() {
	ebegin "Stopping gpsd"
	start-stop-daemon --stop --quiet \
		--pidfile "${GPSPID}"
	eend $? "Failed to stop gpsd"
}