Skip to content
Snippets Groups Projects
oracle.init.el6 1.33 KiB
Newer Older
#!/bin/sh
#
#  chkconfig: 2345 98 11
#  description: Startup/shutdown script for oracle.
#


# Source function library.
. /etc/rc.d/init.d/functions

lockfile=/ar/lock/subsys/oracle

USER=oracle
DIR=/u01/app/oracle/DBA_TOOL/utils/local/system/scripts

start () {
        if [ -f /etc/nooracle ]; then
            echo "/etc/nooracle exists, skipping Oracle startup"
            exit 0
        fi


        echo -n "Starting ora wrapper: \n"
        if [ -x $DIR/oracle-wrapper ]; then
		$DIR/oracle-wrapper start
        else
            su -s /bin/bash - $USER -c $DIR/oracle_system_startup.ksh && success || failure
            RETVAL=$?
            [ $RETVAL -eq 0 ] && touch $lockfile
            echo
        fi
        return $RETVAL
}

stop () {
        echo -n "Stopping oracle: "
        if [ -x $DIR/oracle-wrapper ]; then
	    $DIR/oracle-wrapper stop
        else 
            su -s /bin/bash - $USER -c $DIR/oracle_system_shutdown.ksh && success || failure
            RETVAL=$?
            [ $RETVAL -eq 0 ] && rm -f $lockfile
            echo
        fi
}

restart() {
        stop
        start
}

case $1 in
        start)
                start
        ;;
        stop)
                stop
        ;;
        restart)
                restart
        ;;
        *)

        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac

exit $RETVAL