[FIX] Schedule jobs even if their next time has passed.
[odoo/odoo.git] / win32 / OpenERPServerService.py
index 85cd884..8f5a083 100644 (file)
@@ -1,36 +1,25 @@
 # -*- encoding: utf-8 -*-
-##############################################################################\r
-#\r
-# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.\r
-#\r
-# $Id$\r
-#\r
-# WARNING: This program as such is intended to be used by professional\r
-# programmers who take the whole responsability of assessing all potential\r
-# consequences resulting from its eventual inadequacies and bugs\r
-# End users who are looking for a ready-to-use solution with commercial\r
-# garantees and support are strongly adviced to contract a Free Software\r
-# Service Company\r
-#\r
-# This program is Free Software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-#\r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-# GNU General Public License for more details.\r
-#\r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
-##############################################################################\r
-#\r
-# OpenERPServerService.py\r
-#\r
-# Script installing OpenERP as Windows service\r
-\r
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution  
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
 # Win32 python extensions modules\r
 import win32serviceutil\r
 import win32service\r
@@ -73,15 +62,13 @@ class OpenERPServerService(win32serviceutil.ServiceFramework):
 \r
 \r
     def StartTERP(self):\r
-    # The server finds now its configuration automatically on Windows\r
-    # We start the ERP Server as an independent process, but we keep its handle\r
-    # The server's binary must be one directory above the service's binary (when py2exe'd the python libraries shouldn' mix)\r
-    service_dir = os.path.dirname(sys.argv[0])\r
-    server_dir = os.path.split(service_dir)[0]\r
-    server_path = os.path.join(server_dir, 'openerp-server.exe')\r
-    self.terpprocess = subprocess.Popen([server_path], \\r
-                                            cwd=server_dir,\r
-                        creationflags=win32process.CREATE_NO_WINDOW)\r
+        # The server finds now its configuration automatically on Windows\r
+        # We start the ERP Server as an independent process, but we keep its handle\r
+        # The server's binary must be one directory above the service's binary (when py2exe'd the python libraries shouldn' mix)\r
+        service_dir = os.path.dirname(sys.argv[0])\r
+        server_dir = os.path.split(service_dir)[0]\r
+        server_path = os.path.join(server_dir, 'openerp-server.exe')\r
+        self.terpprocess = subprocess.Popen([server_path], cwd=server_dir, creationflags=win32process.CREATE_NO_WINDOW)\r
 \r
 \r
     def StartControl(self,ws):\r
@@ -89,14 +76,14 @@ class OpenERPServerService(win32serviceutil.ServiceFramework):
         win32event.WaitForSingleObject(ws, win32event.INFINITE)\r
         self.stopping = True\r
 \r
-    def SvcDoRun(self):\r
-    # Start OpenERP Server itself\r
+    def SvcDoRun(self):
+        # Start OpenERP Server itself\r
         self.StartTERP()\r
         # start the loop waiting for the Service Manager's stop signal\r
-    thread.start_new_thread(self.StartControl, (self.hWaitStop,))\r
-    # Log a info message that the server is running\r
-    servicemanager.LogInfoMsg("OpenERP Server up and running")\r
-    # verification if the server is really running, else quit with an error\r
+        thread.start_new_thread(self.StartControl, (self.hWaitStop,))\r
+        # Log a info message that the server is running\r
+        servicemanager.LogInfoMsg("OpenERP Server up and running")\r
+        # verification if the server is really running, else quit with an error\r
         self.terpprocess.wait()\r
         if not self.stopping:\r
             sys.exit("OpenERP Server check: server not running, check the logfile for more info")\r