Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- # Define the servers in array. Here you can put the IP's or hostnames.
- my @server = ('serv1', 'serv2');
- # Loop through servers.
- foreach my $s (@server) {
- # Issue command on each element using command line for ARG.
- # Also print the servers name.
- print '### Running command on: '.$s."\n";
- # Run the command on each server.
- system 'ssh myusernam@'.$s.' '.$ARGV[0];
- print '--== DONE ==--'."\n";
- }
- exit 0;
Add Comment
Please, Sign In to add comment