#!/bin/sh

# Author: Todd Boss
# Purpose: rc script to start/stop Oracle

# Instructions: install this script in the following two directories/filenames:
#   /etc/rc3.d/S99oracle
#   /etc/rc1.d/K01oracle

# Note! the dbstart/dbshut scripts depend on /var/opt/oracle/oratab being configured
# correctly (as in, with a "Y" in the third field for the servers in question)

# Also, modify $ORACLE_HOME/bin/dbshut to shutdown immediate ... perhaps even
# abort, since a regular shutdown waits for connections to end normally

ORACLE_BASE=/opt/oracle
ORACLE_HOME=/opt/oracle/product/9.2.0
#ORACLE_SID=EOPF

case $1 in
'start')             
        echo "Starting Listner....."
        su - oracle -c  '$ORACLE_HOME/bin/lsnrctl start'

        echo "Starting Database ...."
        su - oracle -c '$ORACLE_HOME/bin/dbstart'
        ;;                
'stop')
        echo "Stopping Database ...."
        su - oracle -c '$ORACLE_HOME/bin/dbshut'

        echo "Stopping Listner....."
        su - oracle -c '$ORACLE_HOME/bin/lsnrctl stop'
        ;;
*)               
        echo "usage: /etc/rc3.d/S99oracle {start|stop}"
        echo "usage: /etc/rc1.d/K01oracle {start|stop}"
        ;;
esac         

exit 0

