Laxman Vemula
Laxman Vemula

Reputation: 61

JSch ChannelExec time out after 15 minutes

I am running a command on remote server using JSch's ChannelExec. My script usually takes more than 15 minutes to run. But the channel is getting closed after 15 minutes and the exit status stays equal to -1.

I have even tried to wait until the channel is closed. But channelExec.isClosed() returns true after 15 minutes.

I think I need to set timeout configuration somewhere but I couldn't figure it out. Setting Session.setTimeout() doesn't work.

Upvotes: 1

Views: 1329

Answers (1)

Saransh
Saransh

Reputation: 107

channel also closes after a certain maximmum time limit. to keep the channel open indefinitely use channel.connect(0). Even though the specification says it to run indefinitely yet even this will have a upper limit or else OS itself will timeoue the process

Upvotes: 1

Related Questions