]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
kill of omniNames
authorrahuel <rahuel@opencascade.com>
Thu, 9 Feb 2006 15:06:11 +0000 (15:06 +0000)
committerrahuel <rahuel@opencascade.com>
Thu, 9 Feb 2006 15:06:11 +0000 (15:06 +0000)
bin/killSalomeWithPort.py

index e52a25f883fec97a6273a12c1389926f73042fc2..9f0cd0dd9c9a317c94214935d2b23d9ef5bc7e88 100755 (executable)
@@ -34,7 +34,21 @@ def killMyPort(port):
         pass
         
     if found:
-        a = os.system("pid=`ps -eo pid,command | egrep \"[0-9] omniNames -start "+str(port)+"\" | sed -e \"s%[^0-9]*\([0-9]*\) .*%\\1%g\"`; kill -9 $pid >& /dev/null")
+        cmd = 'pid=`ps -eo pid,command | egrep "[0-9] omniNames -start '+str(port)+'"` ; echo $pid > /tmp/logs/'+os.getenv('USER')+"/_"+port+'_Pid_omniNames.log'
+        a = os.system(cmd)
+        try:
+            fpidomniNames=open('/tmp/logs/'+os.getenv('USER')+"/_"+port+'_Pid_omniNames.log')
+            prc = fpidomniNames.read()
+            fpidomniNames.close()
+            if prc != None :
+                for field in prc.split(" ") :
+                    if field == "omniNames" :
+                        if pidfield != "egrep" :
+                            print 'stop process '+pidfield+' : omniNames'
+                            os.system('kill -9 '+pidfield)
+                    pidfield = field
+        except:
+            pass
         try:
             process_ids=pickle.load(fpid)
             fpid.close()