+def shutdownMyPort(port):
+ """
+ Shutdown SALOME session running on the specified port.
+ Parameters:
+ - port - port number
+ """
+ from salome_utils import generateFileName
+
+ # set OMNIORB_CONFIG variable to the proper file
+ home = os.getenv("HOME")
+ appli = os.getenv("APPLI")
+ kwargs = {}
+ if appli is not None:
+ home = os.path.join(home, appli,"USERS")
+ kwargs["with_username"]=True
+ pass
+ omniorb_config = generateFileName(home, prefix="omniORB",
+ extension="cfg",
+ hidden=True,
+ with_hostname=True,
+ with_port=port,
+ **kwargs)
+ os.environ['OMNIORB_CONFIG'] = omniorb_config
+
+ # give the chance to the servers to shutdown properly
+ try:
+ import time
+ import salome_kernel
+ orb, lcc, naming_service, cm = salome_kernel.salome_kernel_init()
+ # shutdown all
+ lcc.shutdownServers()
+ # give some time to shutdown to complete
+ time.sleep(1)
+ # shutdown omniNames and notifd
+ salome_kernel.LifeCycleCORBA.killOmniNames()
+ except:
+ pass
+ pass
+