#!/bin/bash # # chkconfig: 2345 15 15 # description: Start the gpsd daemon # processname: gpsd # pidfile: /var/run/gpsd.pid # source function library . /etc/rc.d/init.d/functions GPSPRG=/usr/bin/gpsd GPSDEVICE=/dev/usb/tts/0 RETVAL=0 case "$1" in start) gprintf "Starting gpsd daemon: " if [ ! -e $GPSDEVICE ];then gprintf "%s don't exist\n" "$GPSDEVICE" exit 0 fi $GPSPRG -p $GPSDEVICE echo_success echo touch /var/lock/subsys/gpsd ;; stop) gprintf "Shutting down gpsd daemon: " killproc gpsd echo rm -f /var/lock/subsys/gpsd ;; restart|reload) $0 stop $0 start ;; status) status gpsd ;; *) gprintf "Usage: gpsd {start|stop|status|restart|reload}\n" exit 1 esac