1753339 Members
5229 Online
108792 Solutions
New Discussion юеВ

Re: startup script

 
sh5490
Frequent Advisor

Re: startup script

hi yogreej,

This script works fine but we have hardcoded the run level path.

Still i am not able to understand why this not executing under runlevel 2

thanks

shabir



PLATFORM=`uname`
#export ORACLE_HOME PATH
#
LOG=$ORACLE_HOME/stop1.log
touch $LOG
chmod a+r $LOG
#
case $1 in
'start')
echo "$0: starting up" >> $LOG
date >> $LOG
# Start Oracle Net
if [ -f $ORACLE_HOME/bin/tnslsnr ] ;
then
echo "starting Oracle Net Listener" >> $LOG 2>&1
#su - $ORACLE -c "lsnrctl start" >> $LOG 2>&1
fi
echo "Starting Oracle databases" >> $LOG 2>&1
echo $ORACLE $PATH "dbstart $ORACLE_HOME" >> $LOG 2>&1
which su >> $LOG 2>&1
#set -x
ORACLE_SID=cieho;export ORACLE_SID
# oracle owner at your site.
ORACLE=oracle
# CHANGED: PATH=${PATH}:$ORACLE_HOME/bin
ORACLE_HOME=/u01/app/oracle/OraHome_1;export ORACLE_HOME
ORACLE_HOME_LISTNER=/u01/app/oracle/OraHome_1;export ORACLE_HOME_LISTNER
#PATH=${PATH:-/usr/bin}:$ORACLE_HOME/bin
PATH=/usr/sbin:/bin:/usr/bin:/sbin:${PATH}:$ORACLE_HOME/bin
export PATH
HOST=`hostname`
PLATFORM=`uname`
#export ORACLE_HOME PATH
#
LOG=$ORACLE_HOME/stop1.log
touch $LOG
chmod a+r $LOG
#
case $1 in
'start')
echo "$0: starting up" >> $LOG
date >> $LOG
# Start Oracle Net
if [ -f $ORACLE_HOME/bin/tnslsnr ] ;
then
echo "starting Oracle Net Listener" >> $LOG 2>&1
#su - $ORACLE -c "lsnrctl start" >> $LOG 2>&1
fi
echo "Starting Oracle databases" >> $LOG 2>&1
echo $ORACLE $PATH "dbstart $ORACLE_HOME" >> $LOG 2>&1
which su >> $LOG 2>&1
su - $ORACLE -c "dbstart $ORACLE_HOME" >> $LOG 2>&1

;;
'stop')
echo "$0: shutting down" >> $LOG
date >> $LOG
# Stop Oracle Net
#set -x
ORACLE_SID=cieho;export ORACLE_SID
# oracle owner at your site.
ORACLE=oracle
# CHANGED: PATH=${PATH}:$ORACLE_HOME/bin
ORACLE_HOME=/u01/app/oracle/OraHome_1;export ORACLE_HOME
ORACLE_HOME_LISTNER=/u01/app/oracle/OraHome_1;export ORACLE_HOME_LISTNER
#PATH=${PATH:-/usr/bin}:$ORACLE_HOME/bin
PATH=/usr/sbin:/bin:/usr/bin:/sbin:${PATH}:$ORACLE_HOME/bin
export PATH
HOST=`hostname`
PLATFORM=`uname`
#export ORACLE_HOME PATH
#
LOG=$ORACLE_HOME/stop1.log
touch $LOG
chmod a+r $LOG
#
case $1 in
'start')
echo "$0: starting up" >> $LOG
date >> $LOG
# Start Oracle Net
if [ -f $ORACLE_HOME/bin/tnslsnr ] ;
then
echo "starting Oracle Net Listener" >> $LOG 2>&1
#su - $ORACLE -c "lsnrctl start" >> $LOG 2>&1
fi
echo "Starting Oracle databases" >> $LOG 2>&1
echo $ORACLE $PATH "dbstart $ORACLE_HOME" >> $LOG 2>&1
which su >> $LOG 2>&1
su - $ORACLE -c "dbstart $ORACLE_HOME" >> $LOG 2>&1

;;
'stop')
echo "$0: shutting down" >> $LOG
date >> $LOG
# Stop Oracle Net
if [ -f $ORACLE_HOME/bin/tnslsnr ] ;
then
echo "stopping Oracle Net Listener">> $LOG 2>&1
#su - $ORACLE -c "lsnrctl stop" >> $LOG 2>&1
fi
echo "stopping Oracle databases">>$LOG 2>&1
su - $ORACLE -c "dbshut $ORACLE_HOME" >> $LOG 2>&1
;;
# YOU NEED THIS AS WELL, as rc will supply this parameters:
start_msg) echo "starting oracle " ;;
stop_msg) echo "stopping oracle " ;;
*)
echo "usage: $0 {start[_msg]|stop[_msg}"
# SUPPLY AN EXIT CODE FOR exit
retcode=1
;;

# MISSING ESAC
esac

# USUALLY you work with a variable retcode (e.g.) in rc scripts
exit ${retcode:-0}


Yogeeraj_1
Honored Contributor

Re: startup script

> This script works fine but we have hardcoded the run level path.
Please clarify.


>Still i am not able to understand why this not executing under runlevel 2
please upload your /etc/rc.log for us to be able to investigate further

No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Peter Nikitka
Honored Contributor

Re: startup script

Hi,

if your rc-scripts is in such a disorder as posted, I don't wonder, that it does not work.
If it's a corrupted posting, please retry.

If not, especially the PATH declerations must be moved to the top lines in the script before execution any commands.
I would merge the two start/stop sections into one to see clearer what is done in a start or a stop switch.

mfG Peter

PS: Still no time to submit points? We take time to answer questions ;-)
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
sh5490
Frequent Advisor

Re: startup script

hi,

kindly find the rc.log


thanks

shabir
Tim Nelson
Honored Contributor

Re: startup script

Wow. This just might be a record thread.

63 entries

0 points

Peter Nikitka
Honored Contributor

Re: startup script

Hi,

did you find any relevant output of S900dbora?
I did not - what should us be told?
Perhaps it's best to use am extra logfile for the error output of this script. Add at the beginning of the rc-script something like that:

exec 2>/tmp/dbora.stderr
set -x

Post the rc-script and the above logfile.

Next: you still did not answer my question about the rc-script.

mfG Peter

PS: Tim posted two numbers - don't mind, we do not give up soon, so the first number may grow. You are really the only one who can change the second number as well!!
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Laurent Menase
Honored Contributor

Re: startup script

Hi,

I suppose that the application started is using sockets.
socket MUST NOT be used before rc3 S008net.init
else you may get a useless socket and the process may hang in some conditions.

So on hpux always start application using sockets after rc3.d/S008net.init