summaryrefslogtreecommitdiffstats
path: root/gpsd/gpsd.rc
blob: 102c9663eb0b1603a374bc7fcea7569c8e55aabf (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
#!/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