]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - SHUTTLE/AliShuttleTrigger.cxx
Added data member Nptbins
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleTrigger.cxx
index 149bef760d0335778d695fbba00337db1fe2f335..1f10af561c889123547f0b3f5d6d6576f9b85c1a 100644 (file)
@@ -206,6 +206,24 @@ void AliShuttleTrigger::Terminate() {
        fCondition.Signal();
 }
 
+//______________________________________________________________________________________________
+void AliShuttleTrigger::CheckTerminate() 
+{
+       // 
+       // Checks if the Shuttle got an external terminate request by a created file 
+       // This is an alternative to the signal which causes problems with the API libraries
+       //
+
+       if (strlen(fConfig->GetTerminateFilePath()) == 0)
+               return;
+
+       if (gSystem->AccessPathName(fConfig->GetTerminateFilePath()) == kFALSE)
+       {
+               AliInfo("Terminate file exists. Terminating Shuttle...");
+               fTerminate = kTRUE;
+       }
+}
+
 //______________________________________________________________________________________________
 void AliShuttleTrigger::Run() {
        //
@@ -230,6 +248,7 @@ void AliShuttleTrigger::Run() {
 
                while (!(fNotified || fTerminate)) {
                        received=fCondition.TimedWaitRelative(1000*fConfig->GetTriggerWait());
+                       CheckTerminate();
                        if (received==1) break; // 1 = timeout
                }
 
@@ -268,6 +287,7 @@ void AliShuttleTrigger::Run() {
                }
        
                Collect();
+               CheckTerminate();
        }
 
        delete notifier;
@@ -369,10 +389,10 @@ Bool_t AliShuttleTrigger::SendMailDiskSpace(Short_t percentage)
        TString subject;
        TString body;
 
+       Int_t percentage_used = 100 - percentage;       
        subject = Form("%s CRITICAL Disk Space usage exceeds %d%c!",
-                      tmpStr.Data(),percentage,'%');
+                      tmpStr.Data(),percentage_used,'%');
        AliDebug(2, Form("subject: %s", subject.Data()));
-       Int_t percentage_used = 100 - percentage;       
 
        body = "Dear SHUTTLE experts, \n\n";
        body += "The usage of the disk space on the shuttle machine has overcome \n";