diff options
Diffstat (limited to 'gpsd/gpsd.rc')
-rwxr-xr-x | gpsd/gpsd.rc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gpsd/gpsd.rc b/gpsd/gpsd.rc new file mode 100755 index 000000000..102c9663e --- /dev/null +++ b/gpsd/gpsd.rc @@ -0,0 +1,39 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/gpsd +# Description : A daemon for managing GPS. +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} +[ -f /etc/sysconfig/gpsd ] && . /etc/sysconfig/gpsd + +NAME=gpsd +DAEMON=/usr/sbin/$NAME +PIDFILE=/var/run/$NAME/$NAME.pid +PID=$(cat $PIDFILE 2>/dev/null) + +case "$1" in + start) + boot_mesg "Starting $NAME" + [ ! -d /var/run/$NAME ] && install -d /var/run/$NAME + [ -z "$PID" ] && loadproc "$DAEMON" -P $PIDFILE -F /var/run/$NAME/$NAME.sock ${GPSD_OPTIONS} ${DEVICES} + ;; + stop) + boot_mesg "Stopping $NAME" + [ ! -z "$PID" ] && killproc -p $PIDFILE "$DAEMON" + rm -f $PIDFILE + ;; + restart) + $0 stop + sleep 2 + $0 start + ;; + status) + statusproc -p $PIDFILE "$DAEMON" + ;; + *) + echo "usage: $0 {start|stop|restart|status}" +esac + +# End $rc_base/init.d/gpsd |