Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.59 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. die "Need to provide a filename, e.g., $0 dev.tar" if @ARGV < 1;
  4. my ($file, @machines) = @ARGV;
  5.  
  6. my %machines = (
  7.         rackspace => [ qw/vpn iad dfw webfs slice1/ ],
  8.         VPNServer => [ qw/m2 m3 webfs messaging-api1 inf-api1/ ],
  9. );
  10.  
  11. unless (@machines) {
  12.         chomp (my $hostname = `hostname`);
  13.         @machines = @{$machines{$hostname}} if $machines{$hostname};
  14. }
  15.  
  16. foreach my $m (@machines) {
  17.         print "$m ...\n";
  18.         die "Could not scp to $m\n"   if system "scp $file $m:";
  19.         die "Could not untar in $m\n" if system "ssh $m tar xf $file";
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement