If line 3 runs a program (shell script or otherwise) which does not spawn
additional background processes, then that step will not return until line
3 has finished.  It would be synchronous.

Since you've indicated that the desired script actions have not completed
when line 3 returns, I assume that means line 3 is requesting work be
performed even after line 3 has returned.  It is asynchronous.  You're left
with some possible choices:

   - Make line 3 be synchronous instead of asynchronous.  Line 3 won't
   return until its work is complete.  Depending on the nature of the call in
   line 3, this could be easy or very, very difficult
   - Guess an amount to wait and hope that it is long enough.  This is a
   common pattern and may be good enough in many cases.  It is not robust
   against wide variations in execution time or failures in the async step
   - Create a step that waits for the remote task or tasks to complete.
   Have the remote task notify the waiting step that it is complete.



On Sun, Dec 1, 2019 at 10:26 AM Ramesh Mari <rameshmari...@gmail.com> wrote:

> Hello Guys,
>
> This is one tricky question, Please review the problem statement and
> advise me how to  get into further.
>
>
> I have pipeline code which is combined of groovy and sh script. Refer the
> below sample one, based on that the line 4 code should be execute once ssh
> commend done in the target server completely which meant the triggered
> shell script takes time to complete in target server, so its depends on
> load in the script, by that we cannot put static sleep time after the line
> 3. what is the best way to achieve that.
>
> node{
> line 1 code
> line 2 code
> sh "ssh <usercredential>@<serverIP>: sh abc.sh or scb    // line 3
> line 4 code
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/28a8b3da-d8e3-4051-a4a3-7f6144b7ef83%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/28a8b3da-d8e3-4051-a4a3-7f6144b7ef83%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Thanks!
Mark Waite

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtHxcYeKVROXZUv3o1m%3DEzBfbLCbKkYSd4BSB6grsC2efw%40mail.gmail.com.

Reply via email to