blob: 20f3809c5a27c0f48353e5b1e37eaa7301f038a6 [file] [log] [blame]
#!/sbin/runscript
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-geosciences/gpsd/files/gpsd.init-2,v 1.2 2010/09/30 23:07:55 swegener Exp $
depend() {
after dbus
before ntpd
}
PIDFILE=/var/run/${SVCNAME}.pid
DAEMON=/usr/sbin/gpsd
checkconfig() {
if [ -z "${GPSD_SOCKET}" ] && [ -z "${DEVICES}" ]; then
GPSD_SOCKET="/var/run/gpsd.sock"
fi
if [ -n "${GPSD_SOCKET}" ]; then
GPSD_OPTIONS="${GPSD_OPTIONS} -F ${GPSD_SOCKET}"
fi
}
start() {
checkconfig
ebegin "Starting gpsd"
start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- \
${GPSD_OPTIONS} -P ${PIDFILE} ${DEVICES}
eend $?
}
stop() {
ebegin "Stopping gpsd"
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile ${PIDFILE}
eend $?
rm -f ${PIDFILE}
}