Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: PART II: - Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit Status?

RE: PART II: - Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit Status?

From: Reidy, Ron <Ron.Reidy_at_arraybiopharma.com>
Date: Wed, 31 Aug 2005 09:40:44 -0600
Message-ID: <17CAB0BF27BCFC47B0E4554A0E2F962B8733EF@fiji.arraybp.com>


Comments below ...  



Ron Reidy
Lead DBA
Array BioPharma, Inc.

-----Original Message-----
From: Marquez, Chris [mailto:cmarquez_at_collegeboard.org] Sent: Wednesday, August 31, 2005 9:34 AM To: Reidy, Ron; oracle-l_at_freelists.org
Subject: RE: PART II: - Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit Status?

Ron,

>>typeset -i rc=`path_to_script [arg1 ...]`

I think I get it?
This line appears to retrieve RC to imp_wrapper.sh, from imp_script.sh and interrogate? [Reidy, Ronald] Yes. The code between the back ticks (` ... `) executes in a sub shell. when the sub shell terminates, it's return code is saved into the variable rc (which is an integer type). But what (line/code) executes the imp_script.sh?...the same line? [Reidy, Ronald] Yes.

PS If you solve this one for me too I going have to start referencing you in my shell script and crediting you in my status reports!  ;o)
[Reidy, Ronald] Cool. Do I get on the payroll also ;D

Thanks,

Chris Marquez

-----Original Message-----
From: Reidy, Ron [ <mailto:Ron.Reidy_at_arraybiopharma.com> mailto:Ron.Reidy_at_arraybiopharma.com] Sent: Wed 8/31/2005 11:19 AM
To: Marquez, Chris; oracle-l_at_freelists.org Subject: RE: PART II: - Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit Status?

to trap the error code:

typeset -i rc=`path_to_script [arg1 ...]` if [[ $rc -ne 0 ]]; then
  # exit appropriately
fi

You might also want to liik at this: <http://www.samag.com/documents/s=9238/sam0408f/0408f.htm> http://www.samag.com/documents/s=9238/sam0408f/0408f.htm



Ron Reidy
Lead DBA
Array BioPharma, Inc.

 -----Original Message-----
From: oracle-l-bounce_at_freelists.org [ <mailto:oracle-l-bounce_at_freelists.org> mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Marquez, Chris Sent: Wednesday, August 31, 2005 9:11 AM To: oracle-l_at_freelists.org
Subject: PART II: - Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit Status?

In my original quest for help I was working with one script. (btw with you help/code I did complete this task...works well, thanks!)

Now I have a new problem that I do not know how to deal with. I have a wrapper script involved this time.

Something like this;



imp_wrapper.sh
...

#RUN THIS SCRIPT
script1.sh

#RUN THIS FUNCTION
do func1

#RUN THE IMP SCRIPT
imp_script.sh

#RUN THIS SCRIPT
script2.sh

#RUN THIS FUNCTION
do func2

# RETURN CODE: Set next Return Code.
RC=$?
echo 'RETURN CODE' >> $log_file 2>&1
echo $RC >> $log_file


My imp_script.sh has "trap" code and "RETURN CODE" syntax/value also in the script.

But I need to be able to STOP/EXIT/END the parent script; imp_wrapper.sh and set $?=1 when child scrip; imp_script.sh fails with RC=1?

Meaning if import.sh; RC=1, then I want imp_wrapper.sh; RC=1 immediately and exit?

This confuses me and I have no idea how to pass child (exit) RC to the parent script.

Thanks in advance,

Chris Marquez
Oracle DBA

This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.

This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Aug 31 2005 - 10:43:21 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US