2
需要帮助通过scp/sftp将$ cmd输出复制到第二台服务器。我有这个代码;工作正常,但需要很长时间,因为$ cmd输出是〜700MB,15000行。如何使用Net :: SSH2复制文件?
use warnings;
use Net::SSH2;
my ($host, $user, $password, $outfile) = @ARGV;
my $cmd = "show zoneset active";
my $ssh = Net::SSH2->new();
$ssh->connect($host);
$ssh->auth_keyboard($user, $password);
my $channel = $ssh->channel();
$channel->exec($cmd);
open OUTPUT, ">", "$outfile";
while (<$channel>) { print OUTPUT };
$channel->close;
$ssh->disconnect;
我不知道你有什么连接,但对于我发送700MB(+加密)可能需要时间。你确定这个*可以加快吗? – amon