#!/bin/bash # # chkconfig: - 98 02 # description: Gypsy is a daemon that provides application access to a \ # local GPS receiver using the D-Bus system bus. # # processname: gypsy-daemon # pidfile: /var/run/gypsy-daemon.pid # source function library . /etc/init.d/functions RETVAL=0 prog="gypsy-daemon" start() { echo -n $"Starting $prog: " if [ $UID -ne 0 ]; then RETVAL=1 failure else daemon /usr/libexec/gypsy-daemon --pid-file=/var/run/gypsy-daemon.pid RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/gypsy-daemon fi; echo return $RETVAL } stop() { echo -n $"Stopping $prog: " if [ $UID -ne 0 ]; then RETVAL=1 failure else killproc /usr/libexec/gypsy-daemon RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/gypsy-daemon fi; echo return $RETVAL } restart(){ stop start } condrestart(){ [ -e /var/lock/subsys/gypsy-daemon ] && restart return 0 } case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; status) status gypsy-daemon RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart}" RETVAL=1 esac exit $RETVAL