#!/bin/sh

# For Redhat-ish systems
# chkconfig: 345 16 82
#
# description: spin management init file for spin java element manager.
# 
# Copyright 2001. Spinnaker Networks Inc.
# All rights reserved.
export PATH="/bin:/sbin:/usr/bin:/usr/sbin";

# set BOOTUP to verbose display log message on standard out.
#BOOTUP="verbose";

. /etc/rc.d/init.d/functions;

if [ -f /etc/sysconfig/spinmgmt ]; then
    . /etc/sysconfig/spinmgmt;
fi

. /etc/sysconfig/rdb;


RETVAL=0

BASEDIR=`dirname $0`

if [ ! -f  ${BASEDIR}/../lib/functions ]; then
   BASEDIR="/usr/spinmgmt/bin";
fi

. ${BASEDIR}/../lib/functions;
cd /core

case "$1" in
  start)
        shift;
        startTomcat "$*";
	RETVAL=$?
	;;
  stop)
        shift;
        stopTomcat "$*";
	RETVAL=$?
	;;
  restart)
        $0 stop
	sleep 2;
        $0 start
	RETVAL=$?
        ;;
  status)
        tomcatStatus;
	RETVAL=$?
        ;;
  *)
	echo "Usage: spinmgmt {start|stop|restart|status}"
	exit 1
esac

exit $RETVAL
