Guest User

Untitled

a guest
Oct 15th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. # Define the servers in array. Here you can put the IP's or hostnames.
  7. my @server = ('serv1', 'serv2');
  8.  
  9. # Loop through servers.
  10. foreach my $s (@server) {
  11. # Issue command on each element using command line for ARG.
  12. # Also print the servers name.
  13. print '### Running command on: '.$s."\n";
  14.  
  15. # Run the command on each server.
  16. system 'ssh myusernam@'.$s.' '.$ARGV[0];
  17.  
  18. print '--== DONE ==--'."\n";
  19. }
  20.  
  21. exit 0;
Add Comment
Please, Sign In to add comment