ssh into remote nodes, do mulitple commands



Hello,

I'm trying to use Net::SSH to ssh into 3 nodes and move/copy files
with File::Copy. For now, I scripted it to find files of a certain
age and move them.
The $cmd variable is working, but when I try to move the files, it
errors with copy failed. Please critique or suggest a better way.
Thanks in advance!!!!
######################################################

#!/usr/bin/perl -w
use Net::SSH::Perl qw(sshopen2);
use strict;


my %LIST = (

1 => "node1",
2 => "node1",
3 => "node1"

);

foreach my $ESP (sort values %LIST) {


my $user = "user1";
my $host = $ESP;
my $cmd = "sudo find /somedir -name file.err -mtime 1 -exec ls -lt {}
';'";



sshopen2("$user\@$host", *READER, *WRITER, "$cmd") || die "ssh: $!";
print "Connected to $host\n";

while (<READER>) {

if ( $_ ) {
use File::Copy;

move("/tmp/rod","/tmp/nasty") or die "Copy failed: $!";

}

}
}

.



Relevant Pages

  • Re: ssh
    ... In an Age long past, in an Age yet to come, ... Juho Schultz wrote: ... >>> When I try to run angband using ssh to my server I get ... > it seems you get "can't open display" from X in the case your env is not correct. ...
    (rec.games.roguelike.angband)
  • Re: Insecure IKE Implementations Clarification
    ... > Yes and no. SSH is not, by itself, a network-layer encryption solution, ... in this day and age, it is not acceptable to just ... > punt on the problem of first contact and pretend that users will reasonably ...
    (Bugtraq)
  • Re: [fw-wiz] Do you permit X11 via proxy firewall?
    ... that's what 'ssh -X' is for. ... I cannot imagine, in this day and age, allowing ... something like X through/across a border defense, ...
    (Firewall-Wizards)
  • Re: ssh into remote nodes, do mulitple commands
    ... I'm trying to use Net::SSH to ssh into 3 nodes and move/copy files ... but I play one on earth. ...
    (comp.lang.perl.misc)