]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
added a working help, mt
authorHades DAQ <hadaq@cbmpc026.gsi.de>
Wed, 30 Jan 2013 23:29:07 +0000 (00:29 +0100)
committerHades DAQ <hadaq@cbmpc026.gsi.de>
Wed, 30 Jan 2013 23:29:07 +0000 (00:29 +0100)
web/CtsConfig.pm
web/README.txt
web/cts_gui

index 69fb254474c7a32f651227d4892884ada3bc1de5..5863cc4983fa0c98590185511ec504d9f4bc4603 100644 (file)
@@ -2,7 +2,7 @@ package CtsConfig;
 
 #default cts endpoint. can be overriden by a command line parameter
 sub getDefaultEndpoint {
-   return 0xf3c0; 
+   return 0x8000; 
 }
 
 1;
index f44174ca498a6eb324476c1341e9047b5a104634..f5f012b38be0a23ba4d2ce037af9b49917602f07 100644 (file)
@@ -1 +1,2 @@
 If you need a CTS monitor, use the cts script to start, if you just want the webserver use httpi.
+test
index 76e07d01f0b32f91b8fd0da8449369406e74c5ab..f7d5e0b9e315e963600a7fc117a9761770a9a9d9 100755 (executable)
@@ -8,88 +8,95 @@ use Getopt::Long;
 # exit this function is by user interaction, e.g. by pressing
 # CTRL+C
 sub execServerAndMonitor {
-   my $host = shift;
-   my $port = shift;
-   my $htdocsDumpDir = shift;
-   my $quiteParam = shift;
-
-# Start Webserver
-   print "\n\nStart Webserver. Navigate to http://$host:$port\n";
-   print "If you want to access the page from another PC, \n";
-   print "please ensure there's no firewall blocking port $port\n\n";
-   system("./httpi $host $port &");
-
-   sleep 1;
-   
-   $SIG{ 'INT' } = \&clean_up;
-   
-# Exec Monitor   
-   while(1) {
-      system "./cts $quiteParam m $htdocsDumpDir";
-      system "clear";
-      print "If you willingly killed the monitoring script press CTRL+C again!";
-      
-      for(my $i=5; $i; $i--) {
-         print "\n  Monitor will restart in $i second(s)\a";
-         sleep 1;
-      }
-   }
+  my $host = shift;
+  my $port = shift;
+  my $htdocsDumpDir = shift;
+  my $quietParam = shift;
+
+  # Start Webserver
+  print "\n\nStart Webserver. Navigate to http://$host:$port\n";
+  print "If you want to access the page from another PC, \n";
+  print "please ensure there's no firewall blocking port $port\n\n";
+  system("./httpi $host $port &");
+
+  sleep 1;
+
+  $SIG{ 'INT' } = \&clean_up;
+
+  # Exec Monitor
+  while (1) {
+    system "./cts $quietParam m $htdocsDumpDir";
+    system "clear";
+    print "If you willingly killed the monitoring script press CTRL+C again!";
+
+    for (my $i=5; $i; $i--) {
+      print "\n  Monitor will restart in $i second(s)\a";
+      sleep 1;
+    }
+  }
 }
 
 # Print help
 sub help {
-   print <<"HELP"
+  print <<EOFHELP;
 $0 [--port=1234] [--[no]openxterm] [--help]
 Setups up running enviroment for the CTS gui and start webserver.
 
---quite        Don't print monitored values to stdout
+--quiet        Don\'t print monitored values to stdout
 --port         Port number of the webserver
 --noopenxterm  By default, the CTS monitoring results are displayed in an
                additional XTerm window. Use this open to prevent an output.
-HELP
-;
-   exit(0);
+
+EOFHELP
+
+  exit(0);
 }
 
 
 
 # Gather and check parameters
-   if (!$ENV{'DAQOPSERVER'}) {
-      print "ERROR: Missing DAQOPSERVER enviroment variable !\n";
-      print "use 'export DAQOPSERVER=...' to specify the DAQOPSERVER used by the webserver\n\n";
-      exit;
-   }
-
-   my $host = 'localhost';
-   my $port = 1234;
-   my $openxterm = 1;
-   my $monitor = 0;
-   my $help = 0;
-   my $quite = 0;
+if (!$ENV{'DAQOPSERVER'}) {
+  print "ERROR: Missing DAQOPSERVER enviroment variable !\n";
+  print "use 'export DAQOPSERVER=...' to specify the DAQOPSERVER used by the webserver\n\n";
+  exit;
+}
 
-   GetOptions(
-      'openxterm!' => \$openxterm,
-      'port=i' => \$port,
-      'monitor!' => \$monitor,
-      'help!' => \$help,
-      'quite!' => \$quite
-   );
+my $host = 'localhost';
+my $port = 1234;
+my $openxterm = 0;
+my $monitor = 0;
+my $help = 0;
+my $quiet = 0;
+
+GetOptions(
+          'openxterm!' => \$openxterm,
+          'port=i' => \$port,
+          'monitor!' => \$monitor,
+          'help!' => \$help,
+          'quiet!' => \$quiet
+         );
+
+
+if ($help) {
+help();
+exit;
+}
 
 
    my $sharedDir     = "/dev/shm/cts-monitor-$port";
    my $htdocsDumpDir = "htdocs/monitor-$port";
-   my $quiteParam    = $quite ? '--quite ' : '';
-   
+   my $quietParam    = $quiet ? '--quiet ' : '';
+
 
    sub clean_up {
       print "\n\n\n CLEAN UP\n";
       system "rm -rf $sharedDir $htdocsDumpDir";
       exit;
    };
-   
-# If this script was started within xterm - start monitor  
+
+# If this script was started within xterm - start monitor
    if ($monitor) {
-      execServerAndMonitor $host, $port, $htdocsDumpDir, $quiteParam;
+      execServerAndMonitor $host, $port, $htdocsDumpDir, $quietParam;
       exit;
    }
 
@@ -107,14 +114,13 @@ HELP
    system( "ln -s $sharedDir $htdocsDumpDir || mkdir -p $htdocsDumpDir");
    system( "cp htdocs/layout/empty_plot.png $htdocsDumpDir/plot.png" );
    system( "cp htdocs/layout/empty_plot.png $htdocsDumpDir/plotshort.png" );
-   
-   
+
 # Start Monitor (either directly or indirectly via XTERM)"
    print "\n\nStart monitoring script";
    if ($openxterm) {
-      system("xterm -fn '-misc-fixed-medium-r-normal--8-*-*-*-*-*-iso8859-15' +sb -geometry 200x100 +aw +bc -bg LightCoral -j -e '$0 --monitor --port=$port $quiteParam'");
+      system("xterm -fn '-misc-fixed-medium-r-normal--8-*-*-*-*-*-iso8859-15' +sb -geometry 200x100 +aw +bc -bg LightCoral -j -e '$0 --monitor --port=$port $quietParam'");
    } else {
-      execServerAndMonitor $host, $port, $htdocsDumpDir, $quiteParam;
+      execServerAndMonitor $host, $port, $htdocsDumpDir, $quietParam;
    }
-   
+
    clean_up;