Double check if SM is running added. Some redundant output removed from SM
authorjniedzie <jeremi.niedziela@cern.ch>
Thu, 19 Feb 2015 09:57:02 +0000 (10:57 +0100)
committerjniedzie <jeremi.niedziela@cern.ch>
Thu, 19 Feb 2015 09:57:02 +0000 (10:57 +0100)
MONITOR/MONITORzmq/AliCommunicationThread.cxx
MONITOR/alistoragemanager/alistorage.cxx

index c346566..80272ed 100644 (file)
@@ -46,7 +46,6 @@ void AliCommunicationThread::CommunicationHandle()
     
     while(!fFinished)
     {
-        cout<<"COMMUNICATION -- waiting for requests"<<endl;
         request = eventManager->GetClientStruct(socket,5000);
         
         if(request)
@@ -92,7 +91,7 @@ void AliCommunicationThread::CommunicationHandle()
             }
             delete request;
         }
-        else{cout<<"COMMUNICATION -- received NO request"<<endl;}
+        else{sleep(1);}
     }
 }
 
index ca9f1ab..c04bc09 100644 (file)
@@ -28,6 +28,8 @@ void *ServerThreadHandle(void*)
 bool isStorageRunning()
 {
  // check if there is events server already running
+
+  // first mathod with pidof
   const char *pid = gSystem->GetFromPipe("pidof alistorage").Data();
   int pidSize = gSystem->GetFromPipe("pidof alistorage").Sizeof();
   std::string pidOfAll(pid,pidSize);
@@ -36,6 +38,12 @@ bool isStorageRunning()
   std::string word;
   while( pidStream >> word ) ++word_count;
   if(word_count != 1){return true;}
+  
+  // second method with ps
+  cout<<"checking if alistorage is running with ps"<<endl;
+  TString psName = gSystem->GetFromPipe("ps -e -o comm | grep alistorage");
+  if(strcmp(psName.Data(),"alistorage")>0){return true;}
+
   return false;
 }