Frits has asked for the wisdom of the Perl Monks concerning the following question:
Instead of using Perl::Expect which causes the script to grow in scripting I have used NET::SCP:EXPECT for transfering data. When running my perl script uses this package I'm running into an unexpected issue after transferring the data. The part is that I'm trying to up/down load files to/from Cisco routers and switches. A normal ssh access looks like this:
myserver ~ >ssh user@1.2.3.4 TACACS+ Password: Router#exit Connection to 1.2.3.4 closed by remote host. Connection to 1.2.3.4 closed. myserver ~ >
The transfer of my files however are successful but after the completion of the transfer getting: "at /prod/perl5/5.22/modules/lib/perl5/Expect.pm line 760.closed by remote host." and then the script dies. I suspect of the 1st or 2nd line prompted back "Connection to 1.2.3.4 closed (by remote host)." from the router or session is causing this issue.
Is there a way round this?
sub anoc2server { ### Start the SCP my ($user, $passwd, $dstserver, $srcpathfile, $dstpathfile) = @_; my $scp = Net::SCP::Expect->new(host=>$dstserver, user=>$user, + password=>$passwd); {$scp->scp($srcpathfile,$dstpathfile);}} }
srcpathfile and dstpathfile are the full directory paths including the filename.
Frits
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: NET::SCP:EXPECT I'm running into an unexpected issue.
by salva (Canon) on Mar 01, 2017 at 07:53 UTC |