vdubjunkie has asked for the wisdom of the Perl Monks concerning the following question:
It's hard to explain the elation I felt when I found a working ssh module recently. I've hit a low spot though, when I attempted to take my functioning routine and wrap it up inside a list of hosts.
This was a test script I used to simplify troubleshooting, and I still got the following result:#!/usr/bin/perl use strict; use Net::SSH2; my $hf = 'list.txt'; my $user = 'user'; my $pass = 'pass'; my $ssh = Net::SSH2->new(); $ssh->debug(1); open (L,"<$hf") || die "$!"; while(<L>) { chomp $_; print "Connecting now..\n"; $ssh->connect("$_") || warn "$!"; $ssh->auth_password("$user","$pass"); my $chan = $ssh->channel(); $chan->exec('dir'); $chan->close(); } close L;
It's the "Resource is temporarily unavailable" that I'm seeing when I don't have the debug running. I even threw in a sleep to see if that might help. The first host connects perfectly, and I can run commands, etc. That second host (which by the way IS online) fails reliably. Any suggestions?!# ./test.pl Connecting now.. libssh2_channel_open_ex(ss->session, pv_channel_type, len_channel_type +, window_size, packet_size, ((void *)0) , 0 ) -> 0x841ed400 Net::SSH2::Channel::DESTROY Connecting now.. Resource temporarily unavailable at ./test.pl line 14, <L> line 2. libssh2_channel_open_ex(ss->session, pv_channel_type, len_channel_type +, window_size, packet_size, ((void *)0) , 0 ) -> 0x0 Can't call method "exec" on an undefined value at ./test.pl line 21, < +L> line 2. Net::SSH2::DESTROY object 0x8663b6c0
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Net::SSH2 woes
by syphilis (Archbishop) on Jul 02, 2012 at 23:37 UTC | |
by ig (Vicar) on Jul 03, 2012 at 06:32 UTC | |
by vdubjunkie (Novice) on Jul 03, 2012 at 17:55 UTC | |
Re: Net::SSH2 woes
by salva (Canon) on Jul 03, 2012 at 05:31 UTC |
Back to
Seekers of Perl Wisdom