From: HADES hadaq Date: Fri, 25 Oct 2013 17:17:47 +0000 (+0200) Subject: latest additions X-Git-Tag: pre2018~132 X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=2024afa2a99e090bc0fa7733c8acb97cbd1f51f2;p=hadesdaq.git latest additions --- diff --git a/control/gui/expert/Restart_Hmon b/control/gui/expert/Restart_Hmon index 3fad5b4..e20d5ca 100755 --- a/control/gui/expert/Restart_Hmon +++ b/control/gui/expert/Restart_Hmon @@ -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 " ' diff --git a/hmon/Hmon.pm b/hmon/Hmon.pm index eeafa32..df0a305 100644 --- a/hmon/Hmon.pm +++ b/hmon/Hmon.pm @@ -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 index 0000000..abea18a --- /dev/null +++ b/hmon/permanent/hmon_open_ssh_master_channels.pl @@ -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 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 " 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; diff --git a/hmon/stop.sh b/hmon/stop.sh index 9477d68..ff61650 100755 --- a/hmon/stop.sh +++ b/hmon/stop.sh @@ -4,10 +4,11 @@ echo " 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 " Cleaning up..." # rm ~/trbsoft/daq/tools/hmon/files/*.htt -echo "
Scripts Stopped
" > ~/trbsoft/daq/tools/hmon/files/note.htt +echo "
Scripts Stopped
" > ~/trbsoft/hadesdaq/hmon/files/note.htt #echo " Done." diff --git a/utils/command_client.pl b/utils/command_client.pl new file mode 100755 index 0000000..b8ad8c7 --- /dev/null +++ b/utils/command_client.pl @@ -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 ] : Etrax board name. + [-c|--command <'cmd'>] : Command to execute. + [-p|--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 = ; + 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 index 0000000..038d1f5 --- /dev/null +++ b/utils/hades31_powercycle @@ -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 index 0000000..38bf4c8 --- /dev/null +++ b/utils/tunnels_rich_cameras @@ -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