Skip to content

Instantly share code, notes, and snippets.

@flaviolopes
Created September 17, 2010 04:21
Show Gist options
  • Save flaviolopes/583692 to your computer and use it in GitHub Desktop.
Save flaviolopes/583692 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
use 5.12.0;
use File::Rsync;
my %servidor = (
'usuario@serveridor1' => "/path/de/destino/dos/arquivos",
'usuario@serveridor2' => "/path/de/destino/dos/arquivos",
'usuario@serveridor3' => "/path/de/destino/dos/arquivos",
'usuario@serveridor4' => "/path/de/destino/dos/arquivos",
);
my $obj = File::Rsync->new(
{
archive => 1,
compress => 1,
rsh => '/usr/bin/ssh',
'rsync-path' => '/usr/bin/rsync'
}
);
map {
$obj->exec( { src => $_ . ':/path/de/origem', dest => $servidor{$_} } )
or warn "A transferencia falhou!\n"
} keys %servidor;
@fredericorecsky
Copy link

(
$obj->exec( { src => $_ . ':/path/de/origem', dest => $servidor{$_} } )
or
warn "fail\n";
) for keys %servidor;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment