#!/bin/sh
#
# moab         This shell script takes care of starting and stopping
#              the Moab Grid Manager.
#

# Source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi

# Read in the command arguments
case "$1" in
  start)
	# Next start Moab Grid Manager...
	echo -n $"Starting Moab Grid Manager: "
	daemon su -l -s /bin/sh root -c "/opt/moab/sbin/moab"
	echo
	;;

  stop)
	# Stop Moab 
	echo -n $"Shutting down Moab Grid Manager: "
	killproc moab
	echo
	;;

  restart)
	$0 stop
	$0 start
	;;
  *)
	echo $"Usage: moab {start|stop|restart}"
	exit 1
esac

exit 0

