Salome HOME
Fix PAL9538
[modules/kernel.git] / bin / killSalomeWithPort.py
index e3fdea77e4dd30fd4ce8ccfce693f83375a3671b..7cc60a73dfd84f9e972afd36abfd4554cdde6b66 100755 (executable)
@@ -1,9 +1,22 @@
 #!/usr/bin/env python
 import os, sys, pickle, signal, commands
 
+def getPiDict(port,appname='salome',full=True):
+    filedict = []
+    filedict.append( os.getenv('USER') )          # user name
+    filedict.append( os.getenv('HOSTNAME') )      # host name
+    filedict.append( str(port) )                  # port number
+    filedict.append( appname.upper() )            # application name
+    filedict.append( 'pidict' )                   # constant part
+
+    filedict = '_'.join(filedict)
+    if full:
+        filedict = os.getenv("HOME") + '/' + filedict
+    return filedict
+
 ########## kills all salome processes with the given port ##########
 def killMyPort(port):
-    filedict=os.getenv("HOME")+'/'+os.getenv('USER')+"_"+port+'_SALOME_pidict'
+    filedict=getPiDict(port)
     found = 0
     try:
         fpid=open(filedict, 'r')