Hi Gurus,
Some questions regarding wait. I have tried searching in this forum for threads on wait but not completely got what I am looking for.
Background:
One script (.sh) that starts/calls a reference to an application's executable and submits a batch job to it. Objective is to wait for the submitted job and once the batch job finishes, get its return code to the scheduler which is sniffing for a return code.
parent script: run.sh
#! /usr/sh
#sample to understand behavior
/opt/app/r.exe /code/project1/foo.r &
wait
echo $?
I get invalid file /code/project1/foo.r 0
I man(ed) wait read thru it but frankly the WIFEXITED, WNOHANG etc I understood but could not find a simple workable "example". The forum threads talk about spawning multiple scripts form one parent script, or ftp, etc etc which is not what I could use.
Questions:
- Does wait only works with a script starting a child script?
- I google (d) but could not find any simple working example of wait or an example of how best to use the WIFEXITED, WNOHANG, etc etc. Is there a dummy proof simple example?
Perhaps this is rather simple but I have been staring at it for a while now and dazed :wall:
All suggestions are eagerly accepted and thank you in advance.
---------- Post updated at 06:40 PM ---------- Previous update was at 06:36 PM ----------
Hi Gurus,
Some questions regarding wait. I have tried searching in this forum for threads on wait but not completely got what I am looking for.
Background:
One script (.sh) that starts/calls a reference to an application's executable and submits a batch job to it. Objective is to wait for the submitted job and once the batch job finishes, get its return code to the scheduler which is sniffing for a return code.
parent script: run.sh
#! /usr/sh
#sample to understand behavior
/opt/app/r.exe /code/project1/foo.r &
wait
echo $?
I get invalid file /code/project1/foo.r 0
I man(ed) wait read thru it but frankly the WIFEXITED, WNOHANG etc I understood but could not find a simple workable "example". The forum threads talk about spawning multiple scripts form one parent script, or ftp, etc etc which is not what I could use.
Questions:
- Does wait only works with a script starting a child script?
- I google (d) but could not find any simple working example of wait or an example of how best to use the WIFEXITED, WNOHANG, etc etc. Is there a dummy proof simple example?
Perhaps this is rather simple but I have been staring at it for a while now and dazed :wall:
All suggestions are eagerly accepted and thank you in advance.
** I googled, did man wait, did more google. Perhaps it needs to be dummied down a bit for me, lol.