[Ssh-sftp-perl-users] Question to BatchMode
Brought to you by:
dbrobins
From: Stefan A. <ste...@gm...> - 2009-02-17 12:15:54
|
I'm running Net::SSH::Perl 1.34. I execute a bash-script via ssh on a remote server. I register two handles for stdout and stderr: $ssh->register_handler( "stdout", sub { my ( $channel, $buffer ) = @_; print $buffer->bytes; print LOGFILE $buffer->bytes; } ); $ssh->register_handler( "stderr", sub { my ( $channel, $buffer ) = @_; print $buffer->bytes; print LOGFILE $buffer->bytes; } ); Then is send my command with: $ssh->cmd("BashScript"); wait until it finishes. The question I have is: How do I detect a connection loss? The script on the remote server my take a very long time without any activity on the console. I have tried invoking my connection with "options => [ "ServerAliveInterval 15 ServerAliveCountMax 10" ]" or "options => [ "BatchMode yes" ]". However whenever I test it, by pulling out the network cable while the script runs, it just sits there. The longest I have waited is 45 min until I aborted manually. Shouldn't the connection be checked every 300 seconds with "BatchMode yes"? Any help would be appreciated. |