summaryrefslogtreecommitdiffstats
path: root/testing/gpsd/gpsd.initd
diff options
context:
space:
mode:
Diffstat (limited to 'testing/gpsd/gpsd.initd')
-rw-r--r--testing/gpsd/gpsd.initd36
1 files changed, 36 insertions, 0 deletions
diff --git a/testing/gpsd/gpsd.initd b/testing/gpsd/gpsd.initd
new file mode 100644
index 000000000..985271f41
--- /dev/null
+++ b/testing/gpsd/gpsd.initd
@@ -0,0 +1,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"
+}