]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
Cleanup
authorManuel Penschuck <manuel.penschuck@stud.uni-frankfurt.de>
Tue, 29 Jan 2013 20:40:01 +0000 (21:40 +0100)
committerManuel Penschuck <manuel.penschuck@stud.uni-frankfurt.de>
Tue, 29 Jan 2013 20:40:01 +0000 (21:40 +0100)
web/cts_gui

index 944ca85973bfb8cd0c43f8f9bab4081908c63181..da940267c37bf2be4b8a7450c48e73ed127007b9 100755 (executable)
@@ -21,6 +21,8 @@ sub execServerAndMonitor {
 
    sleep 1;
    
+   $SIG{ 'INT' } = \&clean_up;
+   
 # Exec Monitor   
    while(1) {
       system "./cts $quiteParam m $htdocsDumpDir";
@@ -50,6 +52,7 @@ HELP
 }
 
 
+
 # Gather and check parameters
    if (!$ENV{'DAQOPSERVER'}) {
       print "ERROR: Missing DAQOPSERVER enviroment variable !\n";
@@ -78,6 +81,12 @@ HELP
    my $quiteParam    = $quite ? '--quite ' : '';
    
 
+   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 ($monitor) {
       execServerAndMonitor $host, $port, $htdocsDumpDir, $quiteParam;
@@ -85,8 +94,8 @@ HELP
    }
 
 # Setup shared memory
-   print "Trying to kill processes 'cts' and 'dhttpi'\n";
-   system 'pkill "^(cts|dhttpi)$"';
+#   print "Trying to kill processes 'cts' and 'dhttpi'\n";
+#   system 'pkill "^(cts|dhttpi)$"';
 
    print "\n\nTry to map monitoring files to shared memory (if it failes, no harm
    is done. Only the HDD has to work a little bit more)\n";
@@ -94,21 +103,18 @@ HELP
 
    system "rm -rf $sharedDir";
    system "mkdir -p $sharedDir";
-   system( "ln -s $sharedDir $htdocsDumpDir" ) || system ("mkdir -p $htdocsDumpDir");
+   system "chmod 777 $sharedDir";
+   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" );
    
    
-   $SIG{ 'INT' } = sub {
-      print "\n\n\n CLEAN UP\n";
-      system "rm -rf $sharedDir $htdocsDumpDir";
-      exit;
-   };
-
 # 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'");
+      exec("xterm -fn '-misc-fixed-medium-r-normal--8-*-*-*-*-*-iso8859-15' +sb -geometry 200x100 +aw +bc -bg LightCoral -j -e '$0 --monitor --port=$port $quiteParam'");
    } else {
       execServerAndMonitor $host, $port, $htdocsDumpDir, $quiteParam;
-   }
\ No newline at end of file
+   }
+   
+   clean_up;