#!/sbin/runscript # Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 SU=/bin/su ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server ORACLE_OWNER=oraclexe ORACLE_SID=XE export ORACLE_HOME export ORACLE_SID export PATH=$ORACLE_HOME/bin:$PATH LOG="$ORACLE_HOME/log/listener.log" export LC_ALL=C depend() { need net } checkconfig() { if [ ! -f /etc/conf.d/oracle-xe ] ; then eerror "You need to configure Oracle Database 10g Express Edition before" eerror "you can start it." eerror "Run $ORACLE_HOME/bin/oracle_configure.sh first" return 1 fi if [ "$CONFIGURE_RUN" != "true" ] ; then eerror "You need to configure Oracle Database 10g Express Edition before" eerror "you can start it." eerror "Run $ORACLE_HOME/bin/oracle_configure.sh first" return 1 fi } start() { checkconfig || return 1 ebegin "Starting Oracle Net Listener." status=`ps -ef | grep tns | grep oraclexe` if [ "$status" == "" ] then if [ -f $ORACLE_HOME/bin/tnslsnr ] then $SU $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl start" > /dev/null 2>&1 fi fi ebegin "Starting Oracle Database 10g Express Edition Instance." $SU $ORACLE_OWNER -c "$ORACLE_HOME/bin/sqlplus -s /nolog @$ORACLE_HOME/config/scripts/startdb.sql" > /dev/null 2>&1 eend $? } stop() { ebegin "Shutting down Oracle Database 10g Express Edition Instance." $SU $ORACLE_OWNER -c "$ORACLE_HOME/bin/sqlplus -s /nolog @$ORACLE_HOME/config/scripts/stopdb.sql" > /dev/null 2>&1 ebegin "Stopping Oracle Net Listener." $SU $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop" > /dev/null 2>&1 RETVAL=$? if [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$ORACLE_HOME/bin/sqlplus then return $RETVAL fi return $RETVAL }