#!/bin/bash
#
# besd        Startup script for the OPeNDAP BES
#
# chkconfig: 2345 95 05
# description: OPeNDAP BES is a modular framework allowing access to
#	       data files
# processname: besctl
# config: /etc/bes/bes.conf
# pidfile: /var/run/bes.pid

# Path to the besctl script. Note: If the BES is installed using a prefix
# that is not set in the besctl script, add '-i <bes_prefix>' to the value
# of besctl here. This should only be needed in unusual situations.
prefix=/usr
exec_prefix=/usr
besctl=/usr/bin/besctl
prog=besd
RETVAL=0
LD_LIBRARY_PATH="/usr/lib64:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH

# See how we were called.
case "$1" in
  start|stop|status|restart|status|pids|kill|help)
	what=${1}
	shift
	other=$@
	echo "${besctl} ${what} ${other}"
	${besctl} ${what} ${other}
	RETVAL=$?
	;;
  *)
	echo $"Usage: $prog {start|stop|restart|status|pids|kill|help}"
	exit 1
esac

exit $RETVAL
