#!/bin/bash

#
# chkconfig: 35 99 10
# description: Starts and stops Oracle processes
#

# ORACLE_HOME=/u01/app/oracle/product/10.2.0
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
ORA_OWNER=oracle
SID_LIST='pcarddr'

case "$1" in

'start')
if [ -f $ORACLE_HOME/bin/emctl ]; then
  for sid in $SID_LIST; do
    echo  "Starting EM for $sid"
    su - $ORA_OWNER -c "export ORACLE_SID=$sid; $ORACLE_HOME/bin/emctl start dbconsole &"
  done
fi

touch /var/lock/subsys/dbora
;;

'stop')

if [ -f $ORACLE_HOME/bin/emctl ]; then
  for sid in $SID_LIST; do
    echo "Stopping EM for $sid"
    su - $ORA_OWNER -c "export ORACLE_SID=$sid; $ORACLE_HOME/bin/emctl stop dbconsole"
  done
fi

rm -f /var/lock/subsys/dbora
;;

esac

# End of script dbora
