# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/gearmand ]; then
. /etc/sysconfig/gearmand
fi
[ -z “${PIDFILE}” ] && pidfile=”/var/run/gearmand/gearmand.pid”
[ -z “${LOCKFILE}” ] && lockfile=”/var/lock/subsys/gearmand”
gearmand=/usr/sbin/gearmand
prog=gearmand
RETVAL=0
start() {
echo -n $”Starting $prog: ”
daemon –pidfile=$pidfile –user=gearmand $gearmand -d $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && (touch $lockfile; pgrep -f $gearmand > $pidfile)
return $RETVAL
}
stop() {
echo -n $”Stopping $prog: ”
killproc -p $pidfile $gearmand
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f $lockfile $pidfile
}
# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
status)
status -p $pidfile $gearmand
RETVAL=$?
;;
restart|reload)
stop
start
;;
condrestart|try-restart)
if status -p $pidfile $gearmand >&/dev/null; then
stop
start
fi
;;
*)
echo $”Usage: $prog {start|stop|restart|reload|condrestart|status|help}”
RETVAL=3
esac
exit $RETVAL
Leave a Reply