run tests on all hosts automatically
[sysadmin-cookbook] / recepies / netpipe-tcp / test-all.pl
diff --git a/recepies/netpipe-tcp/test-all.pl b/recepies/netpipe-tcp/test-all.pl
new file mode 100755 (executable)
index 0000000..fb48270
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+# usage: test-all.pl hosts
+
+use warnings;
+use strict;
+use autodie;
+use File::Slurp;
+
+chdir '/srv/sysadmin-cookbook/recepies/netpipe-tcp/';
+
+my @hosts = read_file 'hosts';
+
+foreach my $host ( @hosts ) {
+       chomp($host);
+
+       foreach my $to ( @hosts ) {
+               chomp($to);
+               warn "start NPtcp on $to\n";
+               system "ssh $to NPtcp &";
+       }
+
+       warn "TEST from $host\n";
+       system "ssh $host /srv/sysadmin-cookbook/recepies/netpipe-tcp/test.sh";
+       system "rsync $host:/tmp/*.np $host/";
+}