#!/usr/bin/perl if(!open(TEXTFILE, "session.conf")) { print STDERR "Can't open file\n"; exit 0; } $file = time; # Read through first time, and start tcpdumps while () { if (($_ =~ /^\d/)&($_ =~ /T/)) { ($addr) = split(/\t/); print "ssh test\@$addr tcpdumpscript $file\n"; system("ssh test\@$addr /home/test/tcpdumpscript $file"); } } close TEXTFILE; open(TEXTFILE, "session.conf"); while () { if (($_ =~ /^\d/)&($_ =~ /R/)) { ($addr, $mcast, $session) = split(/\t/); ($maddr, $mport) = split(/\//,$mcast); print "ssh test\@$addr pgmcat R $maddr/$mport >/dev/null 2>&1 &\n"; system("ssh test\@$addr /home/test/pgmcatscript R $maddr $mport $session >/dev/null 2>&1 &"); } } close TEXTFILE; open(TEXTFILE, "session.conf"); while () { if (($_ =~ /^\d/)&($_ =~ /S/)) { print "sleep 10\n"; ($addr, $mcast, $session) = split(/\t/); ($maddr, $mport) = split(/\//,$mcast); print "ssh test\@$addr pgmcat S $maddr/$mport\n"; system("ssh test\@$addr /home/test/pgmcatscript S $maddr $mport $session >/dev/null 2>&1 &"); } } close TEXTFILE; print "When tests are complete, type 'ready'\n>>"; if( =~ /ready/) { print "Starting cleanup....\n"; } else { print "Last Chance! Hit enter to begin cleanup....\n>>"; ; } open(TEXTFILE, "session.conf"); while () { if (($_ =~ /^\d/)&($_ =~ /T/)) { ($addr) = split(/\t/); print "ssh test\@$addr killall tcpdump\n"; system("ssh test\@$addr killall tcpdump)"; } } close TEXTFILE; open(TEXTFILE, "session.conf"); while () { if (($_ =~ /^\d/)&(($_ =~ /S/)|($_ =~ /R/))) { ($addr) = split(/\t/); print "ssh test\@$addr killall pgmcat\n"; system("ssh test\@$addr killall pgmcat"); } } close TEXTFILE; open(TEXTFILE, "session.conf"); while () { #retrieve all tcpdump files if (($_ =~ /^\d/)&($_ =~ /T/)) { ($addr) = split(/\t/); print "scp test\@$addr:/usr/home/test/*.log ./tcpdumps/.\n"; system("scp test\@$addr:/usr/home/test/*.log ./tcpdumps/."); } #Retrievs all received text files if (($_ =~ /^\d/)&($_ =~ /R/)) { ($addr, $mcast, $session) = split(/\t/); print "scp test\@$addr:/usr/home/test/pgmcatfiles/receive-$session.txt ./files/.\n"; system("scp test\@$addr:/usr/home/test/pgmcatfiles/receive-$session.txt ./files/."); } } close TEXTFILE; open(TEXTFILE, "session.conf"); # Update testing config log system("echo -e \"Config Record $file\n-----------------------\n\" >> testing.conf"); while () { if ($_ =~ /^\d/) { system("echo \"$_\" >> testing.conf"); } } system("echo -e \"==========================================\n\" >> testing.conf");