killMyPort(mo.groups()[0])
pass
- cmd = "pid=`ps -fea | grep '"+os.getenv('USER')+"' | grep 'ghs3d' | grep 'f /tmp/GHS3D_' | grep -v 'grep' | awk '{print $2}'` ; echo $pid > /tmp/logs/"+os.getenv('USER')+"/_"+"Pid_ghs3d.log"
- a = os.system(cmd)
- try:
- fpidomniNames=open('/tmp/logs/'+os.getenv('USER')+"/_"+"Pid_ghs3d.log")
- prc = fpidomniNames.read()
- fpidomniNames.close()
- if prc != None :
- for field in prc.split(" ") :
- field = field.strip()
- if field != None and len(field) != 0:
- os.system('kill -9 '+field)
- except:
+ if not sys.platform == 'win32':
+ cmd = "pid=`ps -fea | grep '"+os.getenv('USER')+"' | grep 'ghs3d' | grep 'f /tmp/GHS3D_' | grep -v 'grep' | awk '{print $2}'` ; echo $pid > /tmp/logs/"+os.getenv('USER')+"/_"+"Pid_ghs3d.log"
+ a = os.system(cmd)
+ try:
+ fpidomniNames=open('/tmp/logs/'+os.getenv('USER')+"/_"+"Pid_ghs3d.log")
+ prc = fpidomniNames.read()
+ fpidomniNames.close()
+ if prc != None :
+ for field in prc.split(" ") :
+ field = field.strip()
+ if field != None and len(field) != 0:
+ os.system('kill -9 '+field)
+ except:
+ pass
pass
- pass
if __name__ == "__main__":
killAllPorts()
limit=limit+10
while 1:
import os
- status = os.system("netstat -ltn | grep -E :%s > /dev/null 2>&1"%(NSPORT))
- if status:
+ import re
+ from os import getpid
+ from os import system
+
+ if sys.platform == "win32":
+ tmp_file = os.getenv('TEMP');
+ else:
+ tmp_file = '/tmp/'
+ tmp_file += 'hostname_%s'%(getpid())
+
+# status = os.system("netstat -ltn | grep -E :%s > /dev/null 2>&1"%(NSPORT))
+
+ system( "netstat -a -n > %s" % tmp_file );
+
+ f = open( tmp_file, 'r' );
+ lines = f.readlines();
+ f.close();
+
+ pattern = "tcp.*:([0-9]+).*:.*listen";
+ regObj = re.compile( pattern, re.IGNORECASE );
+
+ status = 1;
+ for item in lines:
+ m = regObj.search( item )
+ if m and m.group(1) == NSPORT :
+ status = 0;
+ break;
+
+ if status == 1:
print "%s - OK"%(NSPORT)
#
- from os import getpid
- if sys.platform == "win32":
- tmp_file = os.getenv('TEMP');
- else:
- tmp_file = '/tmp/'
- tmp_file += 'hostname_%s'%(getpid())
- #tmp_file = '/tmp/hostname_%s'%(getpid())
- from os import system
system('hostname > %s'%(tmp_file))
f = open(tmp_file)
myhost = f.read()
myhost = myhost[:-1]
f.close()
- system('rm -f %s'%(tmp_file))
+
+# system('rm -f %s'%(tmp_file))
+ os.remove( tmp_file );
+
#
home = os.environ['HOME']
appli=os.environ.get("APPLI")
args['port'] = os.environ['NSPORT']
#
if save_config:
+ import shutil
from os import system
- system('ln -sf %s %s/.omniORB_last.cfg'%(os.environ['OMNIORB_CONFIG'], home))
+
+# system('ln -s -f %s %s/.omniORB_last.cfg'%(os.environ['OMNIORB_CONFIG'], home))
+ shutil.copyfile( os.environ['OMNIORB_CONFIG'], "%s/.omniORB_last.cfg"%( home ) );
+
pass
#
break