sleep 1;
+ $SIG{ 'INT' } = \&clean_up;
+
# Exec Monitor
while(1) {
system "./cts $quiteParam m $htdocsDumpDir";
}
+
# Gather and check parameters
if (!$ENV{'DAQOPSERVER'}) {
print "ERROR: Missing DAQOPSERVER enviroment variable !\n";
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;
}
# 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";
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;