#!/bin/sh

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

OK=1

#set -x

$PS >$BCNUTMP/ora.out
DATABASES=`$GREP ":Y" $ORATAB | cut -f1 -d:`

for db in $DATABASES
do
	if $GREP ora_pmon_$db $BCNUTMP/ora.out >$BCNUTMP/oracle.out 2>&1
		then
		   :
	else
		   BCNUMSG="$BCNU -m 'error - database $db not running' -f $BCNUTMP/ora.out -e $BCNU_ERR -t $BCNUHOSTTYPE $BCNUHOST"
		   bcnu_err_send
		   OK=
	fi
done

if [ $OK ]
	then
		BCNUMSG="$BCNU -m 'ok - all databases running' -e $BCNU_OK -t $BCNUHOSTTYPE $BCNUHOST"
		bcnu_send
fi
