Bugfix in the NT Service

bzr revid: stephane@tinyerp.com-20081013213045-as7jsps8tvbrkv4s
This commit is contained in:
Stephane Wirtel 2008-10-13 23:30:45 +02:00
parent dd13d1a1d5
commit 262ca045db
1 changed files with 14 additions and 16 deletions

View File

@ -73,15 +73,13 @@ class OpenERPServerService(win32serviceutil.ServiceFramework):
def StartTERP(self):
# The server finds now its configuration automatically on Windows
# We start the ERP Server as an independent process, but we keep its handle
# The server's binary must be one directory above the service's binary (when py2exe'd the python libraries shouldn' mix)
service_dir = os.path.dirname(sys.argv[0])
server_dir = os.path.split(service_dir)[0]
server_path = os.path.join(server_dir, 'openerp-server.exe')
self.terpprocess = subprocess.Popen([server_path], \
cwd=server_dir,
creationflags=win32process.CREATE_NO_WINDOW)
# The server finds now its configuration automatically on Windows
# We start the ERP Server as an independent process, but we keep its handle
# The server's binary must be one directory above the service's binary (when py2exe'd the python libraries shouldn' mix)
service_dir = os.path.dirname(sys.argv[0])
server_dir = os.path.split(service_dir)[0]
server_path = os.path.join(server_dir, 'openerp-server.exe')
self.terpprocess = subprocess.Popen([server_path], cwd=server_dir, creationflags=win32process.CREATE_NO_WINDOW)
def StartControl(self,ws):
@ -93,13 +91,13 @@ class OpenERPServerService(win32serviceutil.ServiceFramework):
# Start OpenERP Server itself
self.StartTERP()
# start the loop waiting for the Service Manager's stop signal
thread.start_new_thread(self.StartControl, (self.hWaitStop,))
# Log a info message that the server is running
servicemanager.LogInfoMsg("OpenERP Server up and running")
# verification if the server is really running, else quit with an error
self.terpprocess.wait()
if not self.stopping:
sys.exit("OpenERP Server check: server not running, check the logfile for more info")
thread.start_new_thread(self.StartControl, (self.hWaitStop,))
# Log a info message that the server is running
servicemanager.LogInfoMsg("OpenERP Server up and running")
# verification if the server is really running, else quit with an error
self.terpprocess.wait()
if not self.stopping:
sys.exit("OpenERP Server check: server not running, check the logfile for more info")