]> jspc29.x-matter.uni-frankfurt.de Git - hadesdaq.git/commitdiff
latest additions
authorHADES hadaq <hadaq@hadesdaq02.gsi.de>
Fri, 25 Oct 2013 17:17:47 +0000 (19:17 +0200)
committerHADES hadaq <hadaq@hadesdaq02.gsi.de>
Fri, 25 Oct 2013 17:17:47 +0000 (19:17 +0200)
control/gui/expert/Restart_Hmon
hmon/Hmon.pm
hmon/permanent/hmon_open_ssh_master_channels.pl [new file with mode: 0755]
hmon/start.sh
hmon/stop.sh
utils/command_client.pl [new file with mode: 0755]
utils/hades31_powercycle [new file with mode: 0755]
utils/tunnels_rich_cameras [new file with mode: 0755]

index 3fad5b495784488f7d25a459aeb7bbe8857ef117..e20d5ca90c2ec868ed724abf80a2f276a2875cea 100755 (executable)
@@ -3,10 +3,10 @@
 xterm -geometry 80x24 -bg orange -fg black -e bash -c '
   ssh -X hadaq@hadesp33 "
   echo Re-starting Hmon
-  cd ~/trbsoft/daq/tools/hmon/
+  cd ~/trbsoft/hadesdaq/hmon/
   ./stopall.sh
-  ./start.sh 1>/dev/null 2>/dev/null
-  echo "Hmon has been restartet"
+  ./start.sh #1>/dev/null 2>/dev/null
+  echo "Hmon has been restarted"
   sleep 5
  "
   '
index eeafa3254c9c8b1abc0e0b53e732226100cd1df7..df0a3054c558edc88784466b363ab40c408c466a 100644 (file)
@@ -4,7 +4,7 @@ use Data::Dumper;
 use warnings;
 use strict;
 
-use constant HMONDIR => "/home/hadaq/trbsoft/daq/tools/hmon/";
+use constant HMONDIR => "/home/hadaq/trbsoft/hadesdaq/hmon/";
 
 our %hublist;
 our $r_hublist = \%hublist;
diff --git a/hmon/permanent/hmon_open_ssh_master_channels.pl b/hmon/permanent/hmon_open_ssh_master_channels.pl
new file mode 100755 (executable)
index 0000000..abea18a
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use v5.10.0;
+
+my @cpus = qw |lxhadeb02 lxhadeb03 lxhadeb04 lxhadeb05 lxhadeb06 lxhadeb07 lxhadesdaq hadesdaq01 hadesdaq02 hades30 hades31 hades33|;
+
+for my $cpu (@cpus) {
+    my $c = "~/trbsoft/hadesdaq/hmon/hmon_ssh hadaq\@$cpu -N -f </dev/null &";
+    print "command: $c\n";
+    system($c);
+}
index 48d37977dc2f7e8f82e4c39805dbebeeb0e5181a..59c234a0bdecfe3062084e353b0ba984207106be 100755 (executable)
@@ -13,7 +13,7 @@ echo "  <Hmon>     No tunnel found, digging new one";
 fi
 
 killall speakdaemon.pl
-cd /home/hadaq/trbsoft/daq/tools/hmon/
+cd /home/hadaq/trbsoft/hadesdaq/hmon/
 
 
 
@@ -49,7 +49,7 @@ ln -fs `pwd`/background.png /srv/www/htdocs/mon/files/
 ln -fs `pwd`/QA.pm /srv/www/htdocs/mon/
 ln -fs `pwd`/styles.css files/
 ln -fs `pwd`/indexstyles.css files/
-#rm ~/trbsoft/daq/tools/hmon/files/*.htt
+#rm ~/trbsoft/hadesdaq/hmon/files/*.htt
 
 echo "  <Hmon>     Starting scripts..."
 ls permanent/hmon_*.pl | perl -ne '
@@ -63,7 +63,7 @@ if($r==0) {
   my $cmd = "pgrep -f \"permanent/$t[1]\"";
   my @qx = qx($cmd);
   exit if (scalar @qx > 0);
-  system("$c 2>>/home/hadaq/trbsoft/daq/tools/hmon/logs/perlerror_$t[1]"); 
+  system("$c 2>>/home/hadaq/trbsoft/hadesdaq/hmon/logs/perlerror_$t[1]"); 
   exit;
   } 
 END: {if($r!=0 and eof()) {foreach (@l) {wait}}} ' &
@@ -78,14 +78,14 @@ push(@l, $r);
 if($r == 0) { 
   chomp $c;
   my @t = split("/",$c);
-  system("$c 2>>/home/hadaq/trbsoft/daq/tools/hmon/logs/perlerror_$t[1]"); 
+  system("$c 2>>/home/hadaq/trbsoft/hadesdaq/hmon/logs/perlerror_$t[1]"); 
   exit;
   } 
 END: {if($r!=0 and eof()) {foreach (@l) {wait}}} ' &
 
-rm ~/trbsoft/daq/tools/hmon/files/note.htt
+rm ~/trbsoft/hadesdaq/hmon/files/note.htt
 
-./speakdaemon.pl 2>>/home/hadaq/trbsoft/daq/tools/hmon/logs/perlerror_speakdaemon &
+./speakdaemon.pl 2>>/home/hadaq/trbsoft/hadesdaq/hmon/logs/perlerror_speakdaemon &
 
 
 sleep 1;
index 9477d68f997780ac80679e7d169f3b800957b7c9..ff61650e5324a1a3d380c7038301953add042a81 100755 (executable)
@@ -4,10 +4,11 @@ echo "  <Hmon>    Killing all sub-processes..."
 pkill -f "\./hmon_.+\.pl" 2>/dev/null 1>/dev/null
 killall hmon*.sh 2>/dev/null 1>/dev/null
 killall hmon_tail 2>/dev/null 1>/dev/null
+killall hmon_ssh 2>/dev/null 1>/dev/null
 
 # echo "  <Hmon>    Cleaning up..."
 # rm ~/trbsoft/daq/tools/hmon/files/*.htt
-echo "<div style='position:absolute;top:5px;left:15px;color:red;font-weight:bold;z-index:100'>Scripts Stopped</div>" > ~/trbsoft/daq/tools/hmon/files/note.htt
+echo "<div style='position:absolute;top:5px;left:15px;color:red;font-weight:bold;z-index:100'>Scripts Stopped</div>" > ~/trbsoft/hadesdaq/hmon/files/note.htt
 #echo "  <Hmon>    Done."
 
 
diff --git a/utils/command_client.pl b/utils/command_client.pl
new file mode 100755 (executable)
index 0000000..b8ad8c7
--- /dev/null
@@ -0,0 +1,149 @@
+#!/usr/bin/perl -w
+
+use English;
+use strict;
+use Getopt::Long;
+use Data::Dumper;
+use IO::Socket;
+
+#- the command line option flags
+my $opt_help    = 0;
+my $opt_etrax;
+my $opt_port    = 4712;
+my $opt_command;
+my $opt_inter   = 0;
+
+GetOptions ('h|help'      => \$opt_help,
+           'e|etrax=s'   => \$opt_etrax,
+           'p|port=i'    => \$opt_port,
+           'c|command=s' => \$opt_command,
+           'i|inter'     => \$opt_inter);
+
+
+if( $opt_help ) {
+    &help();
+    exit(0);
+}
+
+if( &checkArgs() ){
+    print "Exit.\n";
+    exit(1);
+}
+
+my $cmd_server_prtcl  = 'tcp';
+my $cmd_server_answer = "";
+
+&connectCmdServer();
+
+exit(0);
+
+################### END OF MAIN ####################
+
+sub help()
+{
+    print "\n";
+    print << 'EOF';
+command_client.pl    
+
+   This script executes the command via Command_Server running
+   on etrax boards.
+
+Usage:
+   
+   Command line:  command_client.pl 
+   [-h|--help]             : Show this help.
+   [-e|--etrax <name>]     : Etrax board name.
+   [-c|--command <'cmd'>]  : Command to execute. 
+   [-p|--port <port>]      : Port to connect to a server (default: 4712).
+   [-i|--inter]            : Interactive execution of the commands. 
+                             In the interactive mode type 'exit' or 'quit'
+                             to leave the command_client.
+
+Examples:
+
+   Execute command 'sleep 10' on etraxp086:
+      command_client.pl -c 'sleep 10' -e etraxp086
+
+   Execute commands on etraxp086 interactively:
+      command_client.pl -i -e etraxp086
+
+EOF
+}
+
+sub checkArgs()
+{
+    my $retVal = 0;
+
+    unless( $opt_inter || defined $opt_command ){
+       print "You should use either '-c' or '-i' options\n";
+       $retVal = 1;
+    }
+
+    if( $opt_inter && defined $opt_command ){
+       print "You should use either '-c' or '-i' options\n";
+       $retVal = 1;
+    }
+
+    unless( defined $opt_etrax ){
+       print "You must use '-e' option\n";
+       $retVal = 1;
+    }
+    
+    return $retVal;
+}
+
+sub getAnswerFromServer()
+{
+    my ($socket) = @_;
+
+    while( <$socket> ){ 
+       print $_;
+       
+       if( $_ =~ /- END OF OUTPUT -/ ){
+           last;
+       }
+    }
+}
+
+sub connectCmdServer()
+{
+    my $answer;
+
+    my $socket = IO::Socket::INET->new(PeerAddr => $opt_etrax,
+                                      PeerPort => $opt_port,
+                                      Proto    => $cmd_server_prtcl,
+                                      Type     => SOCK_STREAM)
+     or $answer = "ERROR: No response from Cmd Server at $opt_etrax:$opt_port\n";
+
+    unless( defined $answer ){
+       $socket->autoflush(1);
+       print $socket "iamfromhadesdaq\n";
+       $answer = <$socket>;
+
+       print $answer;
+
+       if($opt_inter){
+           #- Interactive commands from keyboard
+           while(1){
+               print "Enter command:  ";
+               my $cmd = <STDIN>;
+               if( $cmd =~ /^exit$/ || $cmd =~ /^quit$/ ){
+                   last;
+               }
+               print $socket "$cmd";
+               &getAnswerFromServer($socket);
+           }
+       }
+       elsif( defined $opt_command ){
+           #- Command from the argument
+           print $socket "$opt_command\n";
+           &getAnswerFromServer($socket);
+       }
+
+       close($socket);
+    }
+
+    unless( $answer =~ /Connection accepted/ ){
+       print $answer;
+    }
+}
diff --git a/utils/hades31_powercycle b/utils/hades31_powercycle
new file mode 100755 (executable)
index 0000000..038d1f5
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+wget -O /dev/null http://admin:kaese@haepcp02/RESET.CGI?a=0\&bi=5\&t=0\&b=1 >/dev/null
diff --git a/utils/tunnels_rich_cameras b/utils/tunnels_rich_cameras
new file mode 100755 (executable)
index 0000000..38bf4c8
--- /dev/null
@@ -0,0 +1 @@
+while true; do  ssh -g -L 12121:192.168.100.121:80 -L 12122:192.168.100.122:80 -L 12123:192.168.100.123:80 -L 12124:192.168.100.124:5900 hadesdaq01 -N -v; sleep 10; done