Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ssh into a list of servers and call the top command, then concatenate the results into a single file
#!/usr/bin/perl
use strict;
use warnings;
exit(0) unless @ARGV;
open(my $fh, '>>', 'mutlti-top.out') or die "$!";
foreach my $server ( @ARGV ) {
print {$fh} `ssh ${server} top -bn 1`;
}
close($fh);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.