#!/bin/sh

###############################################################################
#
# chkconfig: 2345 97 3
#
# description: Starts the event response agent (ERA) application
#
###############################################################################

# Source function library.
. /etc/rc.d/init.d/functions

DMN_NAME=dmnERA
DMN_FULL=/usr/ins/intel/bin/asm/$DMN_NAME

[ -f $DMN_FULL ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
  	# Start the daemon.
        echo -n "Starting ERA: "
	$DMN_FULL &
	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$DMN_NAME && success "$DMN_FULL startup"
	echo
        ;;
  stop)
  	# Stop the daemon.
        echo -n "Stopping ERA: "
	killproc $DMN_NAME
	RETVAL=$?
 	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$DMN_NAME
	echo
        ;;
  status)
	# Get the daemon status.
	status $DMN_NAME
	RETVAL=$?
	;;
  restart)
	# Restart the deamon.
	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
        echo "Usage: $DMN_NAME {start|stop|status|restart}"
        exit 1
esac

exit $RETVAL
