To Stop at error


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers To Stop at error
# 1  
Old 11-24-2008
To Stop at error

Hi All,

I am running parallel process as they all run the same JOBS and only thing which changes is the argument which ia passed.
I am doing it as follows

script.sh $1 &
script.sh $2 &
script.sh $3 &..

and so on.

Now each process has same set of JOBS which are to be executed. Now say if any of the job fails it should ideally stop at that point. However its not happening at present.
Say script.sh $2 & process failed for some reason then it should stop at there itself while script.sh $1 & and script.sh $3 &.. should continue.

At present when script.sh $2 & is failing its not stopping and its going to the next JOB of the list.

Kindly suggest what can be done to avoid this
# 2  
Old 11-24-2008
$? - stored exit status of previous command.

So check if $? = 0 run next script else exit and display error or what ever.
 
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. Red Hat

How can I stop this???

I have a user ( and actually me too) getting this messages when the screen is idle, I need help on stopping this messages: 2012 Feb 20 13:30:22 servername Audit: LENGTH: "330" SESSIONID: "339384" ENTRYID: "1" STATEMENT: "1" USERID: "OPS$PT2ADM" USERHOST: "zzzzzzzzzzz" ACTION: "100" RETURNCODE:... (2 Replies)
Discussion started by: 300zxmuro
2 Replies

4. Shell Programming and Scripting

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... (5 Replies)
Discussion started by: msrahman
5 Replies

5. Solaris

stop - A

I am using solaris x86 with a pc keyboard. i am trying to get to the ok prompt i have tried ctrl-break but it is not working , alt-break will not as well. pls any thought? (4 Replies)
Discussion started by: seyiisq
4 Replies

6. Solaris

I am geting error while trying to stop managed server of WEB LOGIC

Dear All, I am geting error while trying to stop managed server of WEB LOGIC through the command stop_wls managed1_wlsdom02.Can anyone tell me why I am geting this error?managed1_wlsdom02.pid exists at the path mentioned. Do you need any other details?... (0 Replies)
Discussion started by: ASHISH MISHRA
0 Replies

7. UNIX for Advanced & Expert Users

help me stop spammer

Hello, I am hosting a site that someone is bouncing a huge amount of spam off of and I have not been able to find what file they are using to abuse my server. Short of terminating the account and telling my customer to take a hike I am hoping someone can help me find the file that is being... (1 Reply)
Discussion started by: dorpan
1 Replies

8. UNIX for Advanced & Expert Users

how to stop others users to stop viewing what i am doing ?

Hi , I have one question, suppose i am a normal user and when i use 'w' command , it shows who is logged on and what they are doing . Now i want to stop others users to know what i am doing accept the root ? can i do this ? thanks (5 Replies)
Discussion started by: mobile01
5 Replies

9. IP Networking

How do I stop my DHCP ???

Hi, I have a Sun Enterprise 450 with Unix Solaris 5.8. This was recently reconfigured and it now has a DHCP service running. However I want to give it a fixed IP. I have added the IP address in '/etc/hosts and have run 'dhcpconfig' and have followed the simple instructions to switch off DHCP... (1 Reply)
Discussion started by: brettwalmsley
1 Replies

10. Filesystems, Disks and Memory

How do I stop this???

Am having trouble trying to stop the process below ... bash# ps -eaf | grep "tape erase" root 29715 1 0 05:16:22 ttyp1 00:00:00 tape erase /dev/rStp0 root 22464 20933 1 03:40:12 ttyp6 00:00:00 grep tape eraseI've tried ... `kill -9 29715` ... but still no luck. Help... (8 Replies)
Discussion started by: Cameron
8 Replies
Login or Register to Ask a Question