#!/bin/sh
# set up the environment
#. /usr/local/bcnu/etc/bcnuenv
. $BCNUHOME/agent/agent_head

cd /opt/HAHTsite/logs

for FILE in `ls *.log`

do
	$BCNUMESS $FILE >$BCNUTMP/logs.$$

	# checks for warning condition
	if $GREP -i "Unexpected termination" $BCNUTMP/logs.$$ >$BCNUTMP/logs.out 2>/dev/null

	   then
		BCNUMSG="$BCNU -m 'alert - HAHTsite restart ($FILE)' -f $BCNUTMP/logs.out -e $BCNU_ALERT $BCNUHOST"
		bcnu_err_send
		OK=
	 fi
done

rm $BCNUTMP/logs.$$
