#!/bin/sh
#
# init.d/flowfinder : Standard Linux interface to start and stop the SpeedSix FlowFinder Local Motion Estimator Service.
#
# chkconfig: 345 91 35
# description: SpeedSix Software FlowFinder Server (Linux)

# Source function library.
# This defines these things used here:
#  daemon
#  killproc
#  status
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Read our OPTIONS from the sysconfig file
if [ -f /etc/sysconfig/flowfinder ];then
        . /etc/sysconfig/flowfinder
fi

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

RETVAL=0

# Specify the location of our server.
# Assume the daemon function does no magic here about default paths.
prog="/usr/local/SpeedSix/bin/flowfinder"

# Start server procedure
start() {
	echo -n $"Starting $prog: "
	daemon $prog $OPTIONS
	RETVAL=$?
	echo
	return $RETVAL
}

# Stop server procedure
stop() {
	echo -n $"Shutting down $prog: "
	killproc $prog
	RETVAL=$?
	echo
	return $RETVAL
}

# Do what we were asked to do
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
	status $prog
	RETVAL=$?
	;;
  restart)
	stop
	start
	RETVAL=$?
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|status}"
	exit 1
	;;
esac

exit $RETVAL
