#!/bin/sh
#
# chkconfig: 2345 50 50
# description: Performance Event Daemon.

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

case "$1" in
  start)
	if [ -f /var/lock/subsys/perfevtd ]; then
		echo "performance event daemon is already started"
		exit 0
	fi
	echo -n "Starting performance event daemon:                                  "
	/usr/local/share/asmagent/wsma/perfmon/perfmon -c -p ALL -d -t ASM -r 288 300 >& /dev/null &
	echo_success
	echo
	touch /var/lock/subsys/perfevtd
	;;
  stop)
	if [ ! -f /var/lock/subsys/perfevtd ]; then
		echo "performance event daemon is already stopped"
		exit 0
	fi
	echo -n "Stopping performance event daemon:                                  "
	killall -q perfmon
	echo_success
	echo
	rm -f /var/lock/subsys/perfevtd
	;;
  restart)
	$0 stop
	$0 start
	;;
  status)
	if [ -f /var/lock/subsys/perfevtd ]; then
		echo "performance event daemon is started"
	else
		echo "performance event daemon is stopped"
	fi
	;;
  *)
	echo "Usage: perfevtd {start|stop|restart|status}"
	exit 1
esac

exit 0
