I was out not working on unix from quite sometime and came back recently. I would really appreciate a help on one of the issue I am facing....
I am trying to kick off the CodeNameProcess.sh in PARALLEL for all the available codes. The script runs fine in parallel.
Let say there are 50 codes. I am kicking off the CodeNameProcess.sh 50 times in parallel as a background process.
This is working fine.
ISSUE:
I am trying to see out of 50 codes, if for any one of the codes, the script CodeNameProcess.sh errors out,
I want to capture return code ($?) for that. All I am trying to do is to capture the return code of all the 50 codes.
So that at the end of all the 50 codes execution, I can do something with the process if any ONE out of 50 codes has failed.
Below is the code snippet below that is kicking off all the codes successfully in parrallel(which is working fine) but
I am not able to get the proper RETURN CODE even if the scripts for one of the code has failed.
Is there a way to capture the return code from CodeNameProcess.sh running in background.
I would really appreciate your help.
Please Note: The script needs to kick off the CodeNameProcess.sh in parallel for all codes hence kicking it
off as a bacground process: CodeNameProcess.sh &
The $? for getting the return code only works against the last foreground executed task.
With that said, consider the following:
Now you may have to do something tricky like capturing the i/o and possibly identify the "job" also so that you can process these afterward and find which one failed, etc....
Hi Team,
i am executing 3 scripts in background from 1 script and i want to send a message once the script gets completed.these scripts usually takes 1 hr to complete.
My sample script is below,
Vi abc.sh
sh /opt/data/Split_1.sh &
sh /opt/data/Split_2.sh &
sh /opt/data/Split_3.sh &
... (3 Replies)
Hi,
I have created a function f1 defined in script A.sh .I have called this function in background . But I want to use its return value for another function f2 in script A.sh.
I tried declaring it as a global variable, yet it always returns the status as 0. Is there any way with which I can get... (7 Replies)
Hi all, i hava a specific backgroud process. I have de PID of this process. At some time, the process finish his job, is there any way to catch the exit code? I use "echo $?" normally for commands.
Thanks! (2 Replies)
Hey all,
Okay, this one is tricky and I'm not sure there is a niec way to do it, or indeed anyway to do it. The main issue revolves around timing out a hung ssh. I am doing this by creating a wrapper script for the ssh with the following requirements.
My requirements are:
Defineable... (5 Replies)
Hi,
While I am using "|" to join multiple commands, I am not getting the return code when there is error in one of the commnads.
Eg:
b=`find /path/a*.out | xargs basename`
if ; then
echo "Error"
fi
if there is error while finding the file or getting the basename, the $? is... (6 Replies)
Hi,
I have a process that I run in the background that looks like this
${BASEDIR}/ksh/sqler.ksh ${compnames003} &
and I would like to get the return code of the sqler.ksh script.
so my code is like this
${BASEDIR}/ksh/sqler.ksh ${compnames003} &
retcode=$? (3 Replies)
Hello All,
I am a newbie in Shell script programming, and maybe you can help me with my query.
I need to write a shell script (mntServer.ksh) that will start a background process and also to be able to run another script.
The mntServer.ksh script contains:
#!/bin/ksh... (1 Reply)
two programs A and B writting in c++
I am using A to B and I want to know the return code of B.
in B
------------------------
int main()
{
return 11;
}
------------------------
in A
------------------------
int main()
{
system(A);
}
------------------------
Is it the right way... (1 Reply)
two programs A and B writting in c++
I am using A to B and I want to know the return code of B.
in B
------------------------
int main()
{
return 11;
}
------------------------
in A
------------------------
int main()
{
system(A);
}
------------------------
Is it the right way... (1 Reply)
Hi
I have the following piece of code that is calling another child process archive.ksh in the background
while read file;
do
file_name=`ls $file`;
ksh archive.ksh $file_name &;
done < $indirect_file
The problem is, indirect_file may contain anwhere from 2 to 20 different... (5 Replies)