2 import os, sys, pickle, signal, commands
4 ########## kills all salome processes with the given port ##########
6 filedict=os.getenv("HOME")+'/'+os.getenv('USER')+"_"+port+'_SALOME_pidict'
9 fpid=open(filedict, 'r')
12 print "le fichier %s des process SALOME n'est pas accessible"% filedict
16 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")
18 process_ids=pickle.load(fpid)
20 for process_id in process_ids:
22 for pid, cmd in process_id.items():
23 print "stop process %s : %s"% (pid, cmd[0])
25 os.kill(int(pid),signal.SIGKILL)
27 print " ------------------ process %s : %s inexistant"% (pid, cmd[0])
33 pid = commands.getoutput("ps -eo pid,command | egrep \"[0-9] omniNames -start "+str(port)+"\" | sed -e \"s%[^0-9]*\([0-9]*\) .*%\\1%g\"")
35 while pid != "" and len(a.split(" ")) < 2:
36 a = commands.getoutput("pid=`ps -eo pid,command | egrep \"[0-9] omniNames -start "+str(port)+"\" | sed -e \"s%[^0-9]*\([0-9]*\) .*%\\1%g\"`; kill -9 $pid")
37 pid = commands.getoutput("ps -eo pid,command | egrep \"[0-9] omniNames -start "+str(port)+"\" | sed -e \"s%[^0-9]*\([0-9]*\) .*%\\1%g\"")
41 if __name__ == "__main__":
42 for port in sys.argv[1:]: