#!/bin/sh

#. /usr/local/bcnu/etc/bcnuenv
. $BCNUHOME/agent/agent_head

getinfo()
{

MYNAME=`uname -n`

uname -a >$BCNUTMP/bcnu.out
echo "--------" >>$BCNUTMP/bcnu.out
if [ -f $BCNUHOME/etc/systeminfo ]
	then
		echo "${MYNAME}:$BCNUHOME/etc/systeminfo :" >>$BCNUTMP/bcnu.out
		cat $BCNUHOME/etc/systeminfo >>$BCNUTMP/bcnu.out
		echo "--------" >>$BCNUTMP/bcnu.out
fi
$BCNU -a show $MYNAME >>$BCNUTMP/bcnu.out
echo "--------" >>$BCNUTMP/bcnu.out
echo "${MYNAME}:$BCNUHOME/etc/agents :" >>$BCNUTMP/bcnu.out
$BCNU -a get -f /etc/agents $MYNAME >>$BCNUTMP/bcnu.out

}

###################  Start here
case "$4" in

'start')
		BCNUMSG="$BCNU -m 'ok - bcnu system startup' -f $BCNUTMP/bcnu.out -e $BCNU_OK -t $BCNUHOSTTYPE $BCNUHOST"
		getinfo
		bcnu_send
	;;

'stop')
		BCNUMSG="$BCNU -m 'warning - bcnu system shutdown' -f $BCNUTMP/bcnu.out -e $BCNU_BLACK -t $BCNUHOSTTYPE $BCNUHOST"
		bcnu_err_send
	;;
*)
		BCNUMSG="$BCNU -m 'ok - bcnu system available' -f $BCNUTMP/bcnu.out -e $BCNU_OK -t $BCNUHOSTTYPE $BCNUHOST"
		getinfo
		bcnu_send
		echo "$STAMP agent(av): ok - bcnu system available"
	;;

esac

