#! /bin/sh
#
# ident	"@(#)init.es_agent	1.6	03/03/03 SMI"
#
# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

#
#  Enterprise SyMON 2.0 Auto startup script for agent
#

sunmc_basedir=""
/usr/bin/pkginfo -qi SUNWescom
if [ $? -eq 0 ] ; then
    sunmc_basedir=`/usr/bin/pkgparam SUNWescom BASEDIR`
else
    exit 0
fi

case "$1" in

'start')
	if [ -f $sunmc_basedir/SUNWsymon/sbin/es-start ] ; then
	    $sunmc_basedir/SUNWsymon/sbin/es-start -a -Y &
	    CONF_FILE=/etc/opt/SUNWsymon/symon.conf
	    if [ -f "$CONF_FILE" ] ; then
		/usr/bin/grep platform "$CONF_FILE" > /dev/null
		[ $? -eq 0 ] && $sunmc_basedir/SUNWsymon/sbin/es-start -l
	    fi
	fi

	;;

'stop')
	if [ -f $sunmc_basedir/SUNWsymon/sbin/es-stop ] ; then
	    $sunmc_basedir/SUNWsymon/sbin/es-stop -a -l -Y
	fi

	;;

*)
	echo "Usage: /etc/init.d/init.es_agent [start|stop]"
	;;
esac
exit 0
