I prefer the sledgehammer when managing multiple servers. but what about quoting and double quoting and double double qouting.... escaping in on thing.... however how about this....
Here a oneliner for printing the statistics on TCP state of a box.
[dswown@pghpviswl01 ~]$ cat cmd.txt
netstat | perl -MData::Dumper -ne 'BEGIN {%h=();} chomp;$_=~s/\s+/ /g;@x=reverse split/[\s+:]/ if /tcp|udp/; if (@x) {$x[2]=~s/\.c?\w?\w?$//g;print Dumper(\@x), $_ if $x[2] eq '8471';$h{count}{$x[0]}++;$h{$x[0]}{$x[2]}++;
} END { print Dumper(\%h)}'
[dsw@pviswl01 ~]$ cat list | xargs -i{} -t ssh {} $(<cmd.txt)
Where the file 'list' contains the following:
user1@hostA
user2@hostB
No comments:
Post a Comment