On Mon, Jun 29, 2015 at 4:06 PM, Satya Deep Maheshwari <[email protected]>
wrote:

> Hi
>
> I am using ChannelExec for submitting a command to the remote server. This
> command usually takes a while to complete. In my code I have something like:
>
> channelExec.waitFor(ClientChannel.CLOSED, timeout)
>
>
> I want to avoid this wait. I would like to submit a command as a
> background process and move forward without waiting for its completion. I
> tried using
>
> nohup <command> &
>
> as the command I submit but it did not help.
>
> I also tried removing channelExec.waitFor altogether but in that case, the
> command does not get executed on the remote server. Not sure why.
>
> Things work fine if I put an arbitrary timeout out of let's say 1 sec
> before submitting every command, for e.g.
>
> channelExec.waitFor(ClientChannel.CLOSED, 1000)
>
> Not sure if this is the right way and this seems fragile to me.
>
> Is it always necessary to wait for "channel closed " state for sometime to
> get the command executed?
>
> Regards
> Satya Deep
>

Reply via email to