Back to index

salome-kernel  6.5.0
Functions
runNS Namespace Reference

Functions

def startOmni

Function Documentation

def runNS.startOmni ( )

Definition at line 45 of file runNS.py.

00045 
00046 def startOmni():
00047   try:
00048     os.mkdir(os.environ["BaseDir"] + "/logs")
00049     os.chmod(os.environ["BaseDir"] + "/logs", 0777)
00050   except:
00051     #print "Can't create " + os.environ["BaseDir"] + "/logs"
00052     pass
00053   
00054   upath = os.environ["BaseDir"] + "/logs/" + os.environ["Username"]
00055 
00056   try:
00057     os.mkdir(upath)
00058   except:
00059     #print "Can't create " + upath
00060     pass
00061 
00062   #os.system("touch " + upath + "/dummy")
00063   for fname in os.listdir(upath):
00064     try:
00065       if not fname.startswith("."): os.remove(upath + "/" + fname)
00066     except:
00067       pass
00068   #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log")
00069 
00070   print "Name Service... "
00071   #hname=os.environ["HOST"] #commands.getoutput("hostname")
00072   if sys.platform == "win32":
00073           hname=getShortHostName()
00074   else:
00075     hname=socket.gethostname()
00076 
00077   print "hname=",hname
00078   
00079   f=open(os.environ["OMNIORB_CONFIG"])
00080   ss=re.findall("NameService=corbaname::" + hname + ":\d+", f.read())
00081   print "ss = ", ss
00082   f.close()
00083   aPort=re.findall("\d+", ss[0])[0]
00084   
00085   #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/"
00086   #print "sed command = ", aSedCommand
00087   #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"])
00088   global process_id
00089   print "port=", aPort
00090   if sys.platform == "win32":          
00091           #import win32pm
00092           #command = ['omniNames -start ' , aPort , ' -logdir ' , '\"' + upath + '\"']
00093           #os.system("start omniNames -start " + aPort + " -logdir " + "\"" + upath + "\"" )
00094           command = "start omniNames -start " + aPort + " -logdir " + "\"" + upath + "\""
00095           #print command
00096           pid = win32pm.spawnpid( string.join(command, " "), -nc )
00097           process_id[pid]=command
00098   else:
00099     os.system("omniNames -start " + aPort + " -logdir " + upath + " &")
00100 
00101   print "ok"
00102   print "to list contexts and objects bound into the context with the specified name : showNS "
00103 
00104 # In LifeCycleCORBA, FactoryServer is started with rsh on the requested
00105 #    computer if this Container does not exist. Default is localhost.
00106 #    Others Containers are started with start_impl method of FactoryServer Container.
00107 # For using rsh it is necessary to have in the ${HOME} directory a .rhosts file
00108 # Warning : on RedHat the file /etc/hosts contains by default a line like :
00109 # 127.0.0.1               bordolex bordolex.paris1.matra-dtv.fr localhost.localdomain localhost  
00110 #   (bordolex is the station name). omniNames on bordolex will be accessible from other
00111 #   computers only if the computer name is removed on that line like :
00112 #   127.0.0.1               bordolex.paris1.matra-dtv.fr localhost.localdomain localhost
00113 
00114 # To start dynamically Containers on several computers you need to
00115 # put in the ${OMNIORB_CONFIG} file a computer name instead of "localhost"
00116 # example : ORBInitRef NameService=corbaname::dm2s0017
00117 
00118 # If you need to use several omniNames running on the same computer, you have to :
00119 #1. put in your ${OMNIORB_CONFIG} file a computer name and port number
00120 # example : ORBInitRef NameService=corbaname::dm2s0017:1515
00121 #2. start omninames with this port number in runNS.sh
00122 # example : omniNames -start 1515 -logdir ${BaseDir}/logs/${Username} &

Here is the call graph for this function: