#!/bin/bash
#
# sccl_startstop
#

# -----
# Go to directory where this script is placed
cd `dirname $0`

# -----
# Set environment
. ./oracle_env
if [ $? -ne 0 ] ; then
  echo
  echo "Error: Cannot source Oracle's environment script './oracle_env'"
  echo
  exit 1
fi


case $1 in

  start)

    # Add the name of the non-default listener, or NONE, if necessary.
    # .../instance_start [{<non_default_listener> | NONE}]
    # sudo -H -u oracle /oracle/admin/$ORACLE_SID/oracle_tools/instance_start NONE
    sudo -H -u oracle /oracle/admin/$ORACLE_SID/oracle_tools/instance_start listener_$ORACLE_SID
    exit $?
    ;;

  stop)
    # Add the name of the non-default listener, or NONE, if necessary.
    # .../instance_stop_artusq [{<non_default_listener> | NONE}]
    sudo -H -u oracle /oracle/admin/$ORACLE_SID/oracle_tools/instance_stop listener_$ORACLE_SID
    exit $?
    ;;

  *)
    echo "Usage: $0 { start | stop }"
    exit 1
    ;;
esac


