starting alionlinereco on remote machine on SOR signal received by alistorage
authorjniedzie <jeremi.niedziela@cern.ch>
Fri, 7 Nov 2014 14:10:35 +0000 (15:10 +0100)
committerjniedzie <jeremi.niedziela@cern.ch>
Tue, 11 Nov 2014 07:46:16 +0000 (08:46 +0100)
MONITOR/alistoragemanager/AliDIMListenerThread.cxx

index c476755..44b0d5d 100644 (file)
@@ -1,6 +1,9 @@
 #include "AliDIMListenerThread.h"
+#include "AliStorageTypes.h"
 
 #include <iostream>
+#include <sstream>
+#include <fstream>
 
 using namespace std;
 
@@ -31,7 +34,7 @@ AliDIMListenerThread::~AliDIMListenerThread()
         
         fDimSORListener[i] = 0;
         fDimEORListener[i] = 0;
-       }
+    }
 }
 
 void AliDIMListenerThread::InitDIMListeners()
@@ -62,6 +65,30 @@ void AliDIMListenerThread::InitDIMListeners()
 void AliDIMListenerThread::StartOfRun(int run)
 {
     cout<<"DIM Listener -- SOR signal received for run:"<<run<<endl;
+
+    ifstream configFile (GetConfigFilePath());
+    string username,hostname;
+    
+    if (configFile.is_open())
+    {
+        string line;
+        int from,to;
+        while(configFile.good())
+        {
+            getline(configFile,line);
+            from = line.find("\"")+1;
+            to = line.find_last_of("\"");
+            if(line.find("EVENT_SERVER=")==0){hostname=line.substr(from,to-from);}
+            else if(line.find("EVENT_SERVER_USER=")==0){username=line.substr(from,to-from);}
+        }
+        if(configFile.eof()){configFile.clear();}
+        configFile.close();
+    }
+    else{cout<<"Event Manager Editor -- Unable to open config file"<<endl;}
+
+    // Kill reconstruction server
+    gSystem->Exec(Form("ssh -n -f %s@%s \"killall alionlinereco;alionlinereco %d\"",username.c_str(),hostname.c_str(),run));
+
 }
 
 void AliDIMListenerThread::EndOfRun(int run)