~openerp/openobject-server/5.0

« back to all changes in this revision

Viewing changes to win32/OpenERPServerService.py

  • Committer: Stephane Wirtel
  • Date: 2008-09-10 08:46:40 UTC
  • Revision ID: stephane@tinyerp.com-20080910084640-bg1h1bre7mwky8s0
Rename Tiny ERP to OpenERP
Rename tinyerp to openerp

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28
28
##############################################################################
29
29
#
30
 
# TinyERPServerService.py
 
30
# OpenERPServerService.py
31
31
#
32
 
# Script installing Tiny ERP as Windows service
 
32
# Script installing OpenERP as Windows service
33
33
 
34
34
# Win32 python extensions modules
35
35
import win32serviceutil
44
44
import os
45
45
import thread
46
46
 
47
 
class TinyERPServerService(win32serviceutil.ServiceFramework):
 
47
class OpenERPServerService(win32serviceutil.ServiceFramework):
48
48
    # required info
49
 
    _svc_name_ = "tinyerp-service"
50
 
    _svc_display_name_ = "Tiny ERP Server"
 
49
    _svc_name_ = "openerp-service"
 
50
    _svc_display_name_ = "OpenERP Server"
51
51
    # optionnal info
52
 
    _svc_description_ = "Tiny ERP Server service"
 
52
    _svc_description_ = "OpenERP Server service"
53
53
 
54
54
    def __init__(self, args):
55
55
        win32serviceutil.ServiceFramework.__init__(self, args)
67
67
        self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
68
68
        # stop the running TERP Server: say it's a normal exit
69
69
        win32api.TerminateProcess(int(self.terpprocess._handle), 0)
70
 
        servicemanager.LogInfoMsg("Tiny ERP Server stopped correctly")
 
70
        servicemanager.LogInfoMsg("OpenERP Server stopped correctly")
71
71
        # And set my event.
72
72
        win32event.SetEvent(self.hWaitStop)
73
73
 
78
78
    # The server's binary must be one directory above the service's binary (when py2exe'd the python libraries shouldn' mix)
79
79
    service_dir = os.path.dirname(sys.argv[0])
80
80
    server_dir = os.path.split(service_dir)[0]
81
 
    server_path = os.path.join(server_dir, 'tinyerp-server.exe')
 
81
    server_path = os.path.join(server_dir, 'openerp-server.exe')
82
82
    self.terpprocess = subprocess.Popen([server_path], \
83
83
                                            cwd=server_dir,
84
84
                        creationflags=win32process.CREATE_NO_WINDOW)
90
90
        self.stopping = True
91
91
 
92
92
    def SvcDoRun(self):
93
 
    # Start Tiny ERP Server itself
 
93
    # Start OpenERP Server itself
94
94
        self.StartTERP()
95
95
        # start the loop waiting for the Service Manager's stop signal
96
96
    thread.start_new_thread(self.StartControl, (self.hWaitStop,))
97
97
    # Log a info message that the server is running
98
 
    servicemanager.LogInfoMsg("Tiny ERP Server up and running")
 
98
    servicemanager.LogInfoMsg("OpenERP Server up and running")
99
99
    # verification if the server is really running, else quit with an error
100
100
        self.terpprocess.wait()
101
101
        if not self.stopping:
102
 
            sys.exit("Tiny ERP Server check: server not running, check the logfile for more info")
 
102
            sys.exit("OpenERP Server check: server not running, check the logfile for more info")
103
103
 
104
104
 
105
105
 
106
106
if __name__=='__main__':
107
107
    # Do with the service whatever option is passed in the command line
108
 
    win32serviceutil.HandleCommandLine(TinyERPServerService)
 
108
    win32serviceutil.HandleCommandLine(OpenERPServerService)
109
109
 
110
110
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
111
111