1

I'm using Net::SSH2 to run slow admin commands on remote hosts.

Perl 5.8.8 libssh2 1.2.2

I keep getting a strange "timeout" on channel exec. $chan->exec( $command );

The commands being executed are normally running up to an hour (60 min) with minimal output during execution.

Short commands work fine. Slow ones with minimal output return 1 after about one minute.

I have set the socket to blocking and set timeouts to 60 minutes and so on ... nothing helped.

Any ideas?

1 Answer 1

1

Run the command using "nohup command &" in Net::SSH2, then keep the connection alive by checking on the state of the spawned program.

See the following thread for more information:

http://www.perlmonks.org/index.pl?node_id=868377

Sign up to request clarification or add additional context in comments.

2 Comments

I was hoping to solve this with libssh or worst case on the socket. The way the called application works, I can't rely on this kind of process monitoring.
It doesn't need to be state checking, as long as you are pushing something through the socket you should be fine, or you could modify the executed command to output something every few seconds, either with a thread or with a fork(), I'm just tossing stuff out there at this point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.