peitur
peitur

Reputation: 121

perl Net::SSH2 channel exec timeout

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?

Upvotes: 1

Views: 2302

Answers (1)

Horus
Horus

Reputation: 1175

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

Upvotes: 1

Related Questions