How to get the status code after using lsfsubmit?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to get the status code after using lsfsubmit?
# 1  
Old 01-30-2014
How to get the status code after using lsfsubmit?

Hi,

I am a tester and i am trying to create a batch job.

My dev has created few scripts which performs specific task. Manually we need to run these script one by one. We can only run scriptname2 if script name1 completes.

Code:
lsfsubmit <scriptname1> <param1> <param2> 
lsfsubmit <scriptname2> <param1> <param2>

When this script is run, I immediately get status as DONE on my console.
If i execute command bjobs on the prompt, i can see <scriptname1> still running at the background.
This is not the problem.....

Now, the batch job that i created will take these script one by one and execute them. The condition is same. Unless one script completes, we cannot run the other script. My code is doing the same thing

BUT

My ACTUAL PROBLEM is when my script runs this <scriptname1>, it will capture the status code even before the job is complete at the background, hence it returns the status code as 0 ALWAYS. I beleive this is because lsfsubmit returns DONE at the console but runs the job @ the background.


I want to wait for the job @ the background to complete and the capture the status code as 0 or non 0.
How to do that?

thanks
arghadeep

---------- Post updated at 02:35 AM ---------- Previous update was at 02:26 AM ----------

Code:
lsfsubmit Commission.sh ${PARAMARGS}   
temp=$?
 
if [ ${temp} != 0 ]
then
else
fi


Last edited by Don Cragun; 01-30-2014 at 03:51 AM.. Reason: Add CODE and ICODE tags.
# 2  
Old 01-30-2014
If lsfsubmit (a child of your shell) starts something in the background (a grandchild of your shell) and doesn't wait for it to finish, there is no way for you to capture the exit status of your grandchildren in your current shell unless your grandchildren save their exit status to somewhere that your shell can access (a file, a shared memory segment, ...) before they exit. And, if the grandchildren are terminated by an uncaught signal, even if they were willing to record their exit status when they terminate by normal means, they will not be able to record their exit status before they are terminated by the uncaught signal.

Since lsfsubmit is the parent of the processes in question, it could capture the exit status of its children when they exit and report that information back to your shell before it terminates. But, if it exits before its children, there is no direct way for a grandparent to reap its grandchildren's status.
This User Gave Thanks to Don Cragun For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Understanding exit code status

I have a file with size as 120,371 bytes in local machine and trying to FTP it to a remote server using put command. say that it transferred exactly the same size of 120,371 bytes and hence it returns a 226 code. I have a doubt on how the rule is made for 226 - if both size on local and remote... (7 Replies)
Discussion started by: penqueen
7 Replies

2. Shell Programming and Scripting

Checking LB status.. stuck in script syntax of code

#!/bin/ksh #This script will check status of load balancer in AIX servers from hopbox #Steps to do as folows : #Login to server #netstat -ani | grep <IP> #check if the output contains either lo0 OR en0 #if the above condition matches, validation looks good #else, send an email with impacted... (7 Replies)
Discussion started by: vinil
7 Replies

3. Shell Programming and Scripting

Status code checker for 1300 URLs is running 15 mins

hi All, I wrote a shell script for checking the status code of the pages. for 1300 URLs, it is taking 15 mins to run. Can anyone pls provide a solution to make the script to run faster. about 5 mins.. In my script i used "while loop" and "wget --server-response". Thank You! (16 Replies)
Discussion started by: vidhyaS
16 Replies

4. UNIX for Dummies Questions & Answers

302 server status code to 301/404 server status code

Hello, Sorry for my english. I have an arcade site. mydomain.com/game.html If database has the game name is good. mydomain.com/fd43f54.html if database has not the game name redirect to mydomain.com by 302 error code. if database has not the game name i want a 301/404 error code and no... (0 Replies)
Discussion started by: hoo
0 Replies

5. Solaris

Tomcat Error-HTTP Status code 500

when I typed path http://localhost:8080/MyFirst/HelloWorld in web-browser ,it came up with error HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception ... (0 Replies)
Discussion started by: srinivas2828
0 Replies

6. Shell Programming and Scripting

Terminal And Cron Job Return Different Status Code

Dear All, I want to write a shell script to test the server is running or not. The method is pinging the server and examine the status code. the script: #/bin/tcsh ping -c 3 host if ($? != 0) then actionA endif This script work fine in terminal. The status code is 0 when the... (1 Reply)
Discussion started by: isaac_ho
1 Replies

7. Shell Programming and Scripting

How to capture status code and echo a message

Im trying to execute application and its return code is below IF Status code=o echo "........" else Staus Code =-2 DJRE then echo "......" Can any one help me how to handle the status code and echo some message. (12 Replies)
Discussion started by: laknar
12 Replies

8. Shell Programming and Scripting

Status code of last command execution

Hello people, I am using KSH and inside my script I do a cksum and check the status code to see whether the command sucessfully. Here even though the cksum fails due to file not existing the status returned is still 0 because the awk command worked fine. How do I capture just the status of the... (1 Reply)
Discussion started by: tipsy
1 Replies

9. Filesystems, Disks and Memory

Receiving status code 39 when accessing files through program.

I'm working on a project to extract some information from archive file. I ran my program through MFCobol animator and I'm receiving a status code of 39(file not compatible) when opening the file for input. I have tried just about everything, rebuild, convert, etc. but I receive the same message.... (6 Replies)
Discussion started by: bigdawg
6 Replies
Login or Register to Ask a Question