Forum OpenACS Q&A: Re: Configure oracle listener

Collapse
Posted by Andrew Piskorski on
RTFM?

This script might also be useful to you, put it in "/etc/init.d/oracle8i-net8" or the like:

#!/bin/sh
#
# chkconfig: 345 84 16
# description: Oracle 8i Listener (aka, Net8)
#
# $Id: oracle8i-net8,v 1.3 2003/08/09 11:06:34 root Exp $

. /etc/profile-oracle.sh
WHAT="Oracle Net8"
CMDNAME=`basename $0`

echo "Oracle 8i listener start/stop"

if [ ! -f $ORACLE_HOME/bin/lsnrctl -o ! -d "$ORACLE_HOME" ]
    then
    echo "$WHAT: ERROR:  $ORACLE_HOME/bin/lsnrctl seems to be missing!"
    exit
fi

case "$1" in
    start)
      echo "Starting $WHAT."
      su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"
      ;;

    stop)
      echo "Shutting down $WHAT."
      su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"
      ;;

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

Then construct the appropriate /etc/rc0.d/ symlinks to point to it. E.g., like these:

$ ls -l /etc/rc?.d/*ora*net*
   /etc/rc0.d/K16oracle8i-net8 -> ../init.d/oracle8i-net8
   /etc/rc1.d/K16oracle8i-net8 -> ../init.d/oracle8i-net8
   /etc/rc2.d/K16oracle8i-net8 -> ../init.d/oracle8i-net8
   /etc/rc3.d/S84oracle8i-net8 -> ../init.d/oracle8i-net8
   /etc/rc4.d/S84oracle8i-net8 -> ../init.d/oracle8i-net8
   /etc/rc5.d/S84oracle8i-net8 -> ../init.d/oracle8i-net8
   /etc/rc6.d/K16oracle8i-net8 -> ../init.d/oracle8i-net8

Of course, my particular script above won't work at all unless you have /etc/profile-oracle.sh setup. Search in my old Oracle notes for what I recommend putting into that file.