From: Cahit Ugur Date: Wed, 24 Jun 2015 09:39:05 +0000 (+0200) Subject: added check_ping.pl and readout.pl to the tools X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=44b946f40eb0da09e899f346e4635e99146b1d7f;p=daqtools.git added check_ping.pl and readout.pl to the tools --- diff --git a/tools/check_ping.pl b/tools/check_ping.pl new file mode 100755 index 0000000..bfcc610 --- /dev/null +++ b/tools/check_ping.pl @@ -0,0 +1,61 @@ +#!/usr/bin/perl + +use warnings; +use strict; +use Parallel::ForkManager; +use Net::Ping; +use Data::Dumper; + +my @trbs = (78, 84, 101, 102); + +my $map = { + 1 => { trb => 84, sys => "TDC 00"}, + 2 => { trb => 101, sys => "TDC 01"}, + 3 => { trb => 78, sys => "TDC 02"}, + 4 => { trb => 102, sys => "TDC 03"}, + 0 => { trb => 61, sys => "CTS"}, +}; + + +my $MAX_PROCESSES=50; +my $pm = Parallel::ForkManager->new($MAX_PROCESSES); + +#my $p = Net::Ping->new(); + +#print Dumper keys %$map; +#exit; +foreach my $ct (keys %$map) { + #my $num = sprintf "%3.3d", $ct; + my $trbnum= $map->{$ct}->{trb}; + my $num = sprintf "%3.3d", $trbnum; + my $host= "trb" . $num; + my $system = $map->{$ct}->{sys}; + #print "192.168.0.$ct $host.gsi.de $host\n"; + #my $r = $p->ping($host,1); + my $c= "ping -W1 -c1 $host"; + + my $pid = $pm->start and next; + + + #my $p = Net::Ping->new("udp", 1); + #my $r = $p->ping("192.168.0.56"); + #$p->close(); + #print "result: $r\n"; + + my $r = qx($c); + my $sysnum = sprintf "0x80%.2x", $ct; + $sysnum = "0x7999" if $ct == -1; + #printf "$sysnum, system: %-8s, trb: $host ", $system; + printf "$sysnum $host %-8s ", $system; + if (grep /64 bytes/, $r) { + print "is alive.\n"; + } + else { + print "is not alive.\n"; + } + + $pm->finish; # Terminates the child process +} + +$pm->wait_all_children; +#$p->close(); diff --git a/tools/readout.pl b/tools/readout.pl new file mode 100755 index 0000000..723c2dd --- /dev/null +++ b/tools/readout.pl @@ -0,0 +1,81 @@ +#!/usr/bin/perl +use warnings; +use strict; +use Getopt::Long; + +my $help = ""; +my $dataPath = "/d/"; +my $label = "test"; +my $time = -1; +my $name = "cc"; +my $dabc; +my $c; + +my $result = GetOptions ( + "h|help" => \$help, + "d|dabc" => \$dabc, + "t|time=i" => \$time, + "l|label=s" => \$label, + "n|filename=s" => \$name, + "p|path=s" => \$dataPath + ); + +if($help) { + print "Usage: start_readout.pl