]> jspc29.x-matter.uni-frankfurt.de Git - hades_mdc_settings.git/commitdiff
add script to ping power boards
authorhadaq <hadaq@hades33.gsi.de>
Tue, 27 Aug 2024 08:57:03 +0000 (10:57 +0200)
committerhadaq <hadaq@hades33.gsi.de>
Tue, 27 Aug 2024 08:57:03 +0000 (10:57 +0200)
helperscripts/MDC.pm [new symlink]
helperscripts/MDCPower.pm [new symlink]
helperscripts/powerboard_ping_loop.pl [new file with mode: 0755]
scripts/MDCPower.pm

diff --git a/helperscripts/MDC.pm b/helperscripts/MDC.pm
new file mode 120000 (symlink)
index 0000000..1ab6d9a
--- /dev/null
@@ -0,0 +1 @@
+../scripts/MDC.pm
\ No newline at end of file
diff --git a/helperscripts/MDCPower.pm b/helperscripts/MDCPower.pm
new file mode 120000 (symlink)
index 0000000..efbd8bc
--- /dev/null
@@ -0,0 +1 @@
+../scripts/MDCPower.pm
\ No newline at end of file
diff --git a/helperscripts/powerboard_ping_loop.pl b/helperscripts/powerboard_ping_loop.pl
new file mode 100755 (executable)
index 0000000..dc2bf15
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/perl -w
+use warnings;
+no warnings "portable";
+use Getopt::Long;
+use Data::Dumper;
+use Time::HiRes qw(usleep);
+use lib '.';
+use MDC;
+use MDCPower;
+no warnings 'numeric';
+
+
+while(1){
+
+foreach my $p (0..3){
+  foreach my $s (0..5) {
+    MDCPower::power_ping(MDC::get_address($p,$s,0,5));
+  }
+}
+
+sleep 30;
+}
index 5c8ff15ba5ab1974b43d7cc46ee9d5018ab87bcf..64fdfaddb17677eccb7160d50d0339677ee6940d 100644 (file)
@@ -22,6 +22,18 @@ my $powerboard_registers = {
   'vout' => 7, 'volt' => 7, 'voltage' => 7
   };
 
+###############################################################################
+#ping a power board
+###############################################################################
+sub power_ping {
+  my ($addr) = @_;
+
+  my ($host,$board,$outp) = MDC::get_power_output($addr);
+#  print "$addr $host\n";
+  return if $host eq "-1";
+  system("ping -c 1 -W 1 $host");
+
+  }
 
 ###############################################################################  
 #set the voltage for a given board and channel.