Error handling in script
Hi,
I want to handle the error in a shell script..
requirement is in a.sh i invoke b.sh.Within b.sh i do some ftp operations.Now i want to handle if any error occurs while doing ftp.I want to do do some commands if the ftp fails i.e.error occurs in b.sh....
Thanx in advance
Should be simple enough ...
a.sh:
b.sh
rc=$?
if [ $rc -ne 0 ]
then
echo "errors happend"
fi
.b.sh
# Let's assume it will fail ...
RESULT=1
# Do some ftp stuff and determine if it worked
# that needs to be up to you how to decide that
# if it HAS worked then:
if [ $it_worked -eq 0 ]
then
RESULT=0
fi
exit $RESULTThe $it_worked variable (and the if test) is just there to show the RESULT=0 - ypu'll need to work out how to decide if the ftp stuff worked
Similar Messages
-
30EA3/EA2/EA1: Error handling for scripts?
Hi dev,
As in request http://htmldb.oracle.com/pls/otn/f?p=42626:39:5363708399271036::NO::P39_ID:561, I was really hoping to find some dialog in 3.0 to Continue script, Cancel script, or Ignore all errors (see also other tools like TOAD).
Just to be sure I'm not missing anything, did this get bumped again to be implemented in a future version (as it did for the past 4 years)?
Still hoping to see this top-5 request planned for 3.0,
K.The particular request is only marked as accepted for 3.0 feature list in our internal feature tracker and has not been worked on for 3.0. At this stage I have moved all those features that were scheduled for 3.0 and that have actually made it into 3.0, onto the "In Release 3.0" list. There are a few left that are still marked as scheduled for 3.0; these will at this stage almost certainly not make it into the release. Once we go production I'll move the remaining requests off that list. Of the long list of requests there are not many that did not make the main release. As for last minute updates - feature freeze means that no new features are added, but we will be fixing bugs until we're satisfied. With the large audience we have there are often conflicting requests and so while it appears we may ignore some, the conflicts can be the influencing force.
Sue -
Flex bug in global error handling
My application's global error handler (uncaught error handler) works mostly, but I found a case where it doesn't work, but should. Before I filed an official bug report I wanted to post the issue here.
Here is the issue: in a module, ErrorEvents that are not listened for and are dispatched by a Flex component are never caught in the application's uncaught error handler.
I have a sample project that demonstrates this. Here is the module in my test case:
<?xml version="1.0" encoding="utf-8"?>
<s:Module xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
private function onClickSparkDispatch():void {
dispatchEvent( new ErrorEvent( ErrorEvent.ERROR, false, false, "test" ) ); // this isn't caught in the uncaught error handler
private function onClickNonSparkDispatch():void {
var nonSparkDispatcher:EventDispatcher = new EventDispatcher();
nonSparkDispatcher.dispatchEvent( new ErrorEvent( ErrorEvent.ERROR, false, false, "test" ) ); // this is caught in the uncaught error handler
]]>
</fx:Script>
<s:HGroup>
<s:Button label="Module Spark Dispatch (broken)" click="onClickSparkDispatch()" />
<s:Button label="Module Non-Spark Dispatch" click="onClickNonSparkDispatch()" />
</s:HGroup>
</s:Module>
Using Flex 4.6
My application statically links in the Flex SDK ("merged into code" in Flash Builder).
My applications works around these two exsiting bugs:
https://bugs.adobe.com/jira/browse/SDK-28018
http://blogs.adobe.com/aharui/2011/04/catching-uncaughterror-in-flex-modules.html
Is this a bug?
Thanks,
RickIt’s been reported. Here is more information and a workaround. http://blogs.adobe.com/aharui/2011/04/catching-uncaughterror-in-flex-modules.html
-
Error Handling in Batch Script
Hi,
I have a script for deleting files from specific folders -
forfiles /P X:\<path> /D -7 /M *.* /S /C "cmd /C del @path /Q"
forfiles /P X:\<path> /D -7 /M *.* /S /C "cmd /C del @path /Q"
I need to implement error handling like folder doesn't exist or files not there etc.
Kindly help me to write the same.
Thanks,
SugataRobocopy is a built-in command.
There is no need to be helpless. You can find information if you search:
http://www.bing.com/search?q=robocopy
Note that this is not a support forum for the robocopy command.
-- Bill Stewart [Bill_Stewart] -
Oracle Error Handling in Shell Scripts
I need to manage 2 diferente class of errors :
Oracle Errors(produced in compilation time) and
Operating Syste Error(e.g. No Datbase conection ORA-1017,etc) my shell its KSH.
Please can you help me how can I manage then?
this my alternative but is not correct ;
#creating conexion with sql
exit | sqlplus -s $USERPV_DB/$PWDPV_DB @$VORDSQLPATH/ord.extractor_porven.sql $VFDESDE $VFHASTA > $VORDDATOS_PATH/ord.extractor_porven$VDATE.dat 2>> $VLOG
#Evaluating last sentence (sqlplus . . . . )
VERROR=$?
#Si VERROR=0 should stop process execution and alert with echo ".."Oracle error handling before compilation time
if [ $VERROR != 0 ]
then
echo "value of VERROR are:$VERROR"
echo "`date +"$V_FORMATDATE"` DATA EXTRACTION WAS NOT SUCESSFUL ERROR BEFORE COMPILATION TIME" >> $VLOG 2> /dev/null
" Here show VERROR
else #Oracle error handling in compilation time
echo "`date +"$V_FORMATDATE"` DATA EXTRACTION WAS NOT SUCESSFUL ERROR BEFORE COMPILATION TIME " >> $VLOG
" Here show VERROR
else if [ $VERROR = 0 ]
" DATA EXTRACTION WAS SUCESSFUL"
fi
Would apreciate your help its very urgent.
Best Regards
Antoniouser5647282 wrote:
I need to manage 2 diferente class of errors :
Oracle Errors(produced in compilation time) and
Operating Syste Error(e.g. No Datbase conection ORA-1017,etc) my shell its KSH.
Please can you help me how can I manage then?
this my alternative but is not correct ;
#creating conexion with sql
exit | sqlplus -s $USERPV_DB/$PWDPV_DB @$VORDSQLPATH/ord.extractor_porven.sql $VFDESDE $VFHASTA > $VORDDATOS_PATH/ord.extractor_porven$VDATE.dat 2>> $VLOG
Piping the output of 'exit' to sqlplus????????? what do you expect from this?
#Evaluating last sentence (sqlplus . . . . )
VERROR=$?any error returned by sqlplus as $? would be a fatal error of sqlplus itself, not any error returned by processing a sql statement. If your script ord.extractor_porven.sql were to generate, say, an ORA-00001, that is NOT an error in sqlplus and so does not return to the OS as an error of sqlplus.
#Si VERROR=0 should stop process execution and alert with echo ".."Oracle error handling before compilation time
if [ $VERROR != 0 ]
then
echo "value of VERROR are:$VERROR"
echo "`date +"$V_FORMATDATE"` DATA EXTRACTION WAS NOT SUCESSFUL ERROR BEFORE COMPILATION TIME" >> $VLOG 2> /dev/null
" Here show VERROR
else #Oracle error handling in compilation time
echo "`date +"$V_FORMATDATE"` DATA EXTRACTION WAS NOT SUCESSFUL ERROR BEFORE COMPILATION TIME " >> $VLOG
" Here show VERROR
else if [ $VERROR = 0 ]
" DATA EXTRACTION WAS SUCESSFUL"
fi
Would apreciate your help its very urgent.
there is no "urgent" here.
"Urgent" means one of two things -
1) people are dying, or
2) you have a customer-facing, revenue-producing production system that is down.
(And to get some perspective on the second case, keep the first in mind.)
For the first, you call whatever civil emergency service seems appropriate.
For the second, you open an SR with Oracle - which requires a paid-up support contract. For them to consider your problem "urgent", you will need to demonstrate that your problem falls under item #2. I seriously doubt your problem fits that criteria.
Best Regards
Antonio -
ICM Scripting Error Handling Best Practice
Can someone tell me what is the best way to handle errors in ICM scripting. For example false node on Send to VRU or Run Ext Script node, I normally handle this with calltypes for errors and then continue the callflow. But recently I noticed that some of my clients are using peripheral variable to store an error message instead of calltype. I am just wonderinmg which is the best option?
I don't think you need a call type, I usually set PV10 = "Error: XYZ". Creating a call type just seems a little redundant, however it would make it easier on the reporting side as you don't have to create any custom queries to search for a specific error type.
david -
Script Error : Handler Not Definied
Hi Gurus,
I try to play a Lingo Script with Director MX 2004 but i got
this message: Script Error : Handler Not Definied
The Debug stops at this line in my code: dosRegister
"70BE7B1-13977F4"
Is anything missing from my Xtras folder?
I have DirectOS though.
Any idea ??
ThxI suspect you have a cast member that uses one of the three
names in the
list and it is not a check box. It's probably before the
actual checkbox
member in the cast so it's finding it first.
Craig Wollman
Lingo Specialist
Word of Mouth Productions
212-928-9581
www.wordofmouthpros.com
"ajrobson" <[email protected]> wrote in
message
news:etn9j1$op2$[email protected]..
>I have a script that get a list of choosen check boxes,
it was working fine
>but
> now when i press the button that calls the script i get
a error saying
> "script
> error property not found" then it lists the line i have
put a * next to
> and
> says #hilite
>
> This is the top part of that script and to my knowlegde
i have not chnaged
> any
> of it and it worked before but now it does not, i also
use a script almost
> identical to this but use it for radiobuttons instead
and the line is the
> same
> in that and that script works, can anybody tell me what
as gone wrong?
>
>
>
> global err
>
> on CheckBoxState -- name of custom handler
> TickedBoxes = [] -- a empty list will be filled where
ever a checkbox is
> ticked
> CheckBoxNames = ["Dr no", "From russia with
love","Casino royale" ]
> repeat with i = 1 to 3 -- repeat for each checkbox
> CurrentCheckbox = CheckBoxNames
> ** if the hilite of member(CurrentCheckbox) then -- if
currentcheckbox
> hilite
> is true (checked)...
> append(TickedBoxes,CurrentCheckbox )
> end if
> end repeat
> return TickedBoxes
> end
> -
ESSCMD in Perl Script - Error handling
Does anyone use Perl scripts to run Esscmd commands? I'm trying to incorporate error handling and I can't seem to get Perl to recognize and error that happened when the Esscmd statement runs. A sample would be much appreciated. The fact that I'm not too familiar with Perl doesn't help! <BR>Thanks much.
Sorted.
Had to change
#!/usr/bin/perl
to
#!/usr/bin/perl -- -
Error handling with shell script
Hi,
I want to write a .sql file with lots of executable statements. These statements need to run on 100 of schemas per database.
I want to have error handling mechanism in this file in such a way that whenever I get any ORA- error or SP error, it should stop executing there.
Please help me.
Thanks.872305 wrote:
Hi,
I want to write a .sql file with lots of executable statements. These statements need to run on 100 of schemas per database.
I want to have error handling mechanism in this file in such a way that whenever I get any ORA- error or SP error, it should stop executing there.
Please help me.
Thanks.
10:47:51 SQL> help whenever sqlerror
WHENEVER SQLERROR
Performs the specified action (exits SQL*Plus by default) if a
SQL command or PL/SQL block generates an error.
WHENEVER SQLERROR {EXIT [SUCCESS|FAILURE|WARNING|n|variable|:BindVariable]
[COMMIT|ROLLBACK] | CONTINUE [COMMIT|ROLLBACK|NONE]}
10:48:07 SQL> -
Issue with SRDemo error handling
Hi All,
Glad the forums are back up and running. In debugging some error-handling issues in our own application, I found an issue in the error handling code of SRDemo. I thought I'd post the issue here, as many of us (myself included) use some SRDemo code as the basis for our own applications.
The issue can be found in the oracle.srdemo.view.frameworkExt.SRDemoPageLifecycle class, specifically in the translateExceptionToFacesErrors method. I'll show the code that has the issue first, and explain the issue afterwards:
if (numAttr > 0) {
Iterator i = attributeErrors.keySet().iterator();
while (i.hasNext()) {
String attrNameKey = (String)i.next();
* Only add the error to show to the user if it was related
* to a field they can see on the screen. We accomplish this
* by checking whether there is a control binding in the current
* binding container by the same name as the attribute with
* the related exception that was reported.
ControlBinding cb =
ADFUtils.findControlBinding(bc, attrNameKey);
if (cb != null) {
String msg = (String)attributeErrors.get(attrNameKey);
if (cb instanceof JUCtrlAttrsBinding) {
attrNameKey = ((JUCtrlAttrsBinding)cb).getLabel();
JSFUtils.addFacesErrorMessage(attrNameKey, msg);
}Now, this bit of code attempts to be "smart" and only show error messages relating to attributes if those attributes are in fact displayed on the screen. It does so by using a utility method to find a control binding for the attribute name. There are two issues with this code, one obvious, and one that is a bit more subtle.
The obvious issue: if there is a binding in the page definition, it doesn't necessarily mean that the attribute is shown on the screen. It's a good approximation, but not exact.
The other issue is more subtle, and led to errors being "eaten," or not shown, in our application. The issue comes if you are using an af:table to display and update your data. In that case, the findControlBinding will not find anything for that attribute, since the attribute is contained within a table binding.
Just posting this as a word to the wary.
Best,
johnsomehow, this message got in the wrong thread....
Hi Frank,
Yes, I simply scripted it out this way to contrast the behaviour if the first attribute was read-only vs not read-only. I found the issue on a page in our app that was simply drag-and-drop the VO from the data control on the page.
It's quite annoying, because our particular use case that hit this error is a "save" button on the page. If the commit operation doesn't return any errors (and it doesn't in this use case!), we add a JSF message saying "save successful" - then the attribute errors are further added later in the page lifecycle, so we get 3 messages: "Save successful" and "Fix this error" and "Tried to set read-only attribute" - quite confusing to the end-user when the only message they should see is "fix this error."
At any rate, the fix is to simply re-order the attributes in the page definition - that doesn't affect the UI at all, other than to fix this issue.
John
it was supposed to be something like:
Hi Frank,
Thanks for the reply. I was simply posting this here so that people who use the SRDemo application techniques as a basis for developing the same functionality in their own apps (like me) can be aware of the issue, and avoid lots of head-scratching to figure out "what happened to the error message?"
John -
File receive adapter command line error handling
Hi,
This is our requirement - After the file receive adapter, we need to run a script. Based on the return code of the script, we need to handle the error handling of the interface (i.e. send an email about the error).
I have looked at the operating system command line in the file adapter. How does XI handle return codes for the command line? If the command line has a error return code, how to send an email from XI?
If anyone has ideas on this topic, please respond!!
thanks,
lasyaHi,
I don't think so, it is possible directly. You can not get the Response back to XI pipeline from the shell script.
But you can think, if you are able to call this from Mapping.
And one more option is using Transport Acknowledgement ( with BPM) if the file is not able to write into the target directory you can raise an alert-
Blog on this-
/people/michal.krawczyk2/blog/2006/06/22/xi-playing-with-the-file-adapters-acknowledgments
Regards,
moorthy -
ESB error handling and notification features
Hello everyone,
I am newbie to oracle SOA ESB. I am an oracle apps guy.
This being my first post to this forum, I have a lot of questions. :-)
For a small intergration requirement, we are looking for a good integration tool
Some requirements are:
1) Flat files will be generated by concurrent programs on oracle apps which need to be transferred to legacy systems.
2) Pick the data from apps tables and insert them into another database. Not much translation required.
After some research, found ESB to be a good fit.
Before actually start using it, we wanted to do a couple of POCs.
So far we are using shell scripts for ftp process. We opted for an integration tool to have DB to DB transmission. Apart from this we need better error handling and error notification mechanism.
Some error conditions:
1) Unavailability of ftp server or Database server.
2) Permission issues. Say some files may not have read, write, deletion permissions. They need to be caught and notified.
3) Mandatory field missing while inserting data which is read from a flat file into a DB table etc..
My initial thoughts on error handling are:
Connection error: To retry for connection errors. If the retry fails send notification via email and also write the failed connection details into an error log file(apart from the server log file).
Data mismatch: NOtification to be sent with the error details.
I would like to know What happens to the file if the destination ftp server is unavailable while ESB is trying to FTP the file. Will ESB retain the file with itself and FTP the file once the ftp server is up?
In BPEL I could see try catch blocks which can be used to handle the errors and thus send notifications.
ESB documents introduced terms like error hospital related to error handling but I was not able to figure out a way of implementing them. As I am not well versed with XML and WSDL I am probably unable to use the fault tab which is in the routing service. I feel Oracle could have given some samples that explain about ESB error handling.
Also to my dismay, adapter docs say that there is a limitation of 7MB size for ftping. Although our file sizes often fall below this size, I would want to know if there is any workaround to over come this size constraint.
I think I put a lot of stuff in a single post and may be in the most haphazard way. Please bear with me.
Please suggest me of some documents if any related to my questions.
Would be really great if you can give me a straight forward solution to all the above problems
Hope this forum would be a great help to me.
Cheers,
Robert.I have worked on a few SOA Apps implementations. Some successful and some not so. It really comes down to the type of integrations.
But I would say the majority of your integration will be batch as this is what eBus is all about. If this is the case then I would recommend Oracle Data Integrator. If you go Oracle Data Integrator Suite it includes Service Bus and BPEL. ODI has an eBusiness Suite adapter as well.
The good thing about ODI is that you can use it for data conversion, that conversion can then be reused once live, so the conversion is not throw away.
In SOA 10.1.3.4 the limit of 7MB has been resolved but you must be using the file / FTP adapter for input and out, from the sounds of it you want to call concurrent programs so this probably wouldn't work.
cheers
James -
Oracle stored procedure call failed,but not captured by the error handling
Hi All,
I have a unix shelll script which calls a stored proc in Oracle, the stored proc call failed due to "ORA-01033: ORACLE initialization or shutdown in progress".
But it is not captured in the error handling block, Any ideas why this had happened?
SQL file had : my_test_sql.sql
exec my_proc(..............);
Unix shell script has this call:
sqlplus -s my_user/my_pwd@db1 @my_test_sql.sql
if [[ $? -ne 0 ]]; then
echo "failed"
exit 1
else
echo "success"
fi
If i execute the above shell, I'm getting the following
ERROR:
ORA-01033: ORACLE initialization or shutdown in progress
SP2-0306: Invalid option.
Usage: CONNÝECT¨ Ýlogon¨ ÝAS SYSDBA¨
where <logon> ::= <username>Ý/<password>¨Ý@<connect_identifier>¨ | /
success.
This puzzled me, any pointers?The $? status variable shows the return code of the last command executed. It will be difficult to determine what the exit status of your sql script is without knowing the script. Do you have any "WHENEVER SQLERROR EXIT" statements in the script?
The ORA-01033 error happens when the database is not open, perhaps in recovery, or startup or shutdown is halted due to a failed or full disk, error in archiving or writing to redo, etc. -
Error Handling in Oracle Sales Cloud
Is there a best practice guide/document for error handling in Oracle Sales Cloud?
For example: Error handling in groovy scripts, business processes.
Can someone provide a starting point to this topic?
Thanks,
AbhishekHi.
Please review this short video showing you the online logging feature for Application Composer - Groovy. It's very simple and gives you a basic debug capability.
https://www.youtube.com/watch?v=RcyeKQY2ZGo&index=35&list=PL1ZiAfFIniZf_Uu4qTcp5IZYdFOm9K5o3
Kind regards,
Richard
FA Developer Relations -
Query related to error handling
hi All,
In my proxy flow i have stage level error handler which is configured to an alert pointing to an JMS error queue. When i added service level error handler with same alert.
I am getting duplication of the same error message by stage and service error handler.
For every error i am receiving 2 error messages at the error queue.
Is there any option in ALSB which allows me stop the duplication.Pls check the following script --
SQL>
SQL> create or replace package uu_test
2 is
3 begin
4 test
5 end;
6 /
Warning: Package created with compilation errors.
SQL>
SQL> select * from user_errors
2 where type = 'PACKAGE';
NAME TYPE SEQUENCE LINE POSITION
TEXT
UU_TEST PACKAGE 1 3 1
PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following:
end function package pragma private procedure subtype type
use <an identifier> <a double-quoted delimited-identifier>
form current cursorHope this will fullfill your requirement.
Regards.
Satyaki De.
Maybe you are looking for
-
Cannot check for available downloads nor download media from iTunes store.
Here's what I can do: 1) I can access the internet. 2) I can access and purchase media from the iTunes store. 3) I can stream radio through iTunes. 4) I can download podcasts. Here's what I can't do: 1) I cannot check for available downloads. 2) I ca
-
I have a iPhone 5 now and used to use the iPhone iPhone 4 dock to do composite video to play a movie or NetFlix from my iPhone 4... Any ideas on how ro do this with the iPhone 5. Do any of the adapters handle the video component?
-
Importing html totally changes site. How do I fix in Muse?
I am creating a new web site. I have a lot of content to include that I have created in Word, since that is the only practical way to create white papers that I know of. It took me a while, but I was finally able to create html code that works pretty
-
I wish to install Adobe Photoshop Elements 13. I located my serial number in my old account and when I entered it, I received an error message that the serial number was invalid. I cannot locate my serial number and cannot complete my sign in.
-
I am looking for assistance on installing SQL Spreadsheet. I don't know where I can find the resource files to install this utility. I am using the 8.1.7 standard version CD. Thank you. Linda