Stop load script if error found...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Stop load script if error found...
# 1  
Old 11-03-2010
Stop load script if error found...

Hi all,
Is there any command in Unix, which will stop the load process if any error is found in the i/p file?

I am trying to load 5 files sequentially.
A then
B then
C then
D then
E end;

1) If A encounter's any error while data load, the load process should stop, and it should not continue
2) If A load's, then B load's, then C has errors, then it should stop and should not continue to load D and E.

Appreciate any help, with Unix shell script...
# 2  
Old 11-03-2010
Hi.

What do you mean by "load"?

In normal Unix parlance, such would suffice:

Code:
A && B && C && D && E

But that depends on A, B, etc. "behaving" in normal parlance.
# 3  
Old 11-04-2010
What would we call "load" in normal Unix parlance. I have just started with Unix coding, so i dont know much of these parlance. Would appreciate if you can tell me.

Here's the details:
We have 5 input files, which resided on the Unix server.
We have created a sqlldr script to load the data from input file to oracle table.
The Unix shell script that i created does these things:
1) Looks for the input file, and loads the data into the table, and sends the e-mail to the user along with log file (as attachement), and also counts the total counts in the input file.
If the input file has any error or if the input file is not found in the specified path, then it notifies the user via e-mail alogn with the attached log file.
2) Then the script moves to the next instance or input file and does the above said steps....

I would like to know if, A loads successfully, then it moves over to B, and B loads successfully,, then it moves to C. If C has any issues or file not found, it should stop there........

Hope it is clear....
# 4  
Old 11-04-2010
So with the information given, scottn has replied... (execute A without errrors(&&) B etc...).
If you were expecting more help, its more up to you to give us more to look at...
For instance we have no idea how you wrote your script, so you cant expect us to make your program better...

At simple top down analysis of how the script should work, I can imagine a loop that would process while no errors, meaning also you have test for exit conditions.
# 5  
Old 11-04-2010
For the benefit of those who have not been following msrahman's threads about combining 5 existing scripts into one script whilst adding enhancements such as reporting by email.
The O/P uses bash under Solaris 10 (I think).

This is where we left off:
https://www.unix.com/shell-programmin...e-files-5.html
And here:
https://www.unix.com/shell-programmin...ncement-3.html
# 6  
Old 11-04-2010
Is there any option that we can send the script as attachment (if the scipt is too big to be copy/paste).

---------- Post updated at 10:17 AM ---------- Previous update was at 10:14 AM ----------

Hey,
Thanks methyl for making this work.
I can even send the whole script that i am struggling with, if we have the option to attach the script.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to stop a shell script if it encounters a error?

I am writing a bash shell script for GarazLab's "WP EMAIL CRAWLER - AUTO SCRAPER & REAL TIME EXTRACTOR". it contains some commands. I want to stop the shell execution as soon as it encounters an error. how to do it? (8 Replies)
Discussion started by: tahsin352
8 Replies

2. UNIX for Beginners Questions & Answers

Stop script execution, when we encounter error

Team, Im new to shell scripting please help in below issue: Considering scenario i have 1.sql,2.sql,3.sql and 4.sql . If my second script fails my loop should come out and should not execute 3.sql and 4.sql. Here is my code. #! /bin/bash echo "exit" | user/password | grep Connected >... (4 Replies)
Discussion started by: preethi87
4 Replies

3. Shell Programming and Scripting

UNIX shell script error: not found

Hello All, I'm working on one Unix shell sript that will actually extract a column data from Oracle table using sqlplus and writes onto a file. I'm getting this error when executing the shell script: rpt.ksh: ^JScott: not found Below is the code in the shell script: `sqlplus -s... (1 Reply)
Discussion started by: venkat_reddy
1 Replies

4. Shell Programming and Scripting

+: not found Error in shell script

Hi , I am a newbie to shell scripting. I am getting the error on AIX machine /tadfdc_setup_fed.sh: +: not found Here tadfdc_setup_fed.sh is script which works fine on Linux Machine. But gives error on AIX (1 Reply)
Discussion started by: Anupam Kakade
1 Replies

5. Shell Programming and Scripting

getting the error 'not found' while executing the script

Hi, I am not able to figure out what the problem is: getting the following error sqltst.sh: 1: not found here is the script #!/bin/sh . /home/dev1/.profile . /home/dev1/.infenv `sqlplus -s $REPDB_LOGON << EOF SET SERVEROUT ON SET FEEDBACK OFF SET HEADING OFF SET TRIMSPOOL... (4 Replies)
Discussion started by: svajhala
4 Replies

6. Shell Programming and Scripting

Shell script run error ksh: not found

Hi All, I am trying to run a script to FTP files from one UNIX server to another UNIX server. Actually I can able to FTP file successfully by manually or paste whole script at prompt. But when I am trying to run script it is giving error. Please let me know the cause. #!/bin/sh... (3 Replies)
Discussion started by: nz80qy
3 Replies

7. Shell Programming and Scripting

Shell stop process after found value in file

hi guys can somebody help me here... i've a file that contains total of ip that connects to my server and their ip like this : 80 80 xxx.xxx.xx.xxx 75 75 xxx.xxx.xx.xxx 73 73 xxx.xxx.xx.xxx where first columns and second were the total connections... ... (0 Replies)
Discussion started by: kriezo
0 Replies

8. Shell Programming and Scripting

Need help in wrting Load Script for a Load-Resume type of load.

hi all need your help. I am wrting a script that will load data into the table. then on another load will append the data into the existing table. Regards Ankit (1 Reply)
Discussion started by: ankitgupta
1 Replies

9. Shell Programming and Scripting

Installer script -- function not found error

I am writing an installation script on AIX. This involves typical checks of some pre requisites like java, oracle, some version checks, disk space etc. It is a long script. I am facing a strange problem. There are a no of functions used in the script. What I see is that the installer complains of... (1 Reply)
Discussion started by: asutoshch
1 Replies

10. Shell Programming and Scripting

Newb scripting question, I get the error script not found

This is probably a really simple problem, but goes easy on me I'm still a newb. The problem I have is that a script (we'll call it script.script) I edited won't run for some reason, I get the error "ksh: script.script: not found" The location of my script is as follows: /home/users/arkitech ... (3 Replies)
Discussion started by: Arkitech
3 Replies
Login or Register to Ask a Question