The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to capture status code and echo a message laknar Shell Programming and Scripting 12 04-30-2008 11:13 AM
How to know the status of process running in background sumanta Shell Programming and Scripting 8 03-04-2008 05:03 AM
how to capture oracle export log while running as background process hippo2020 SUN Solaris 4 07-03-2007 03:39 PM
exit status of Invoking two or more scripts in background Omkumar Shell Programming and Scripting 4 03-31-2005 08:25 AM
capture the process id when starting a background process jleavitt Shell Programming and Scripting 10 04-04-2002 09:04 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-03-2008
Prashantckc Prashantckc is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 18
How to capture the status of background process

Hi All

I am performing a parallel job by using the background concept.
Here is what I am doing.

SCRIPTA
1. Take in the argument list store it in an Array
2. Call to SCRIPTB in a while loop till the arguments in the array are present. The call is as follows
. ./SCRIPTB [i] &

3. Use the wait command to wait for all the wait till all the background process are completed.
4. ECHO SUCCESS.


Now the point is that What I need to do is to perform some operation if all the call to SCRIPTB were succesful. Now for this I am doing the following

1. Take in the argument list store it in an Array
2. Call to SCRIPTB in a while loop till the arguments in the array are present. The call is as follows
. ./SCRIPTB [i] &
if [ $? -eq 0 ] #ok execution
then
echo Incrementing the counter for ${brn_array[brnIndex]}
successCounter=`expr $successCounter + 1`
fi

3. Use the wait command to wait for all the wait till all the background process are completed.
4. Verify the counter and print SUCCESS

But the problem is that even if for some arguments . ./SCRIPTB [i] fails then also the return value is 0 and the counter is increasing.

Kindly suggest
 

Bookmarks

Tags
background, background job, exit code, return code

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:14 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0