Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7051

Multiple windows services on the same machine

From Massi <massi_srb@msn.com>
Newsgroups comp.lang.python
Subject Multiple windows services on the same machine
Date 2011-06-05 09:54 -0700
Organization http://groups.google.com
Message-ID <4227ae83-a4a3-46b0-bc25-c5a1d89c08a4@32g2000vbe.googlegroups.com> (permalink)

Show all headers | View raw


Hi everyone, I'm writing a script which implement a windows service
with the win32serviceutil module. The service works perfectly, but now
I would need to install several instances of the same service on my
machine for testing purpose.
This is hard since the service name is hard-coded in the service class
definition:

class MyService(win32serviceutil.ServiceFramework) :
    _svc_name_ = 'MyService'
    _svc_display_name_ = 'Instance ofMyService'

    def __init__(self, args) :
        win32serviceutil.ServiceFramework.__init__(self, args)
        self.hWaitStop = win32event.CreateEvent(None, 0, 0, None)

    def SvcStop(self) :
        self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
        sys.stopservice = "true"
        win32event.SetEvent(self.hWaitStop)

    def SvcDoRun(self) :
        #Do something...

So can anyone point me out which is the best way to "parametrize" the
service name? Thanks in advance for your help!

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Multiple windows services on the same machine Massi <massi_srb@msn.com> - 2011-06-05 09:54 -0700
  Re: Multiple windows services on the same machine Ben Finney <ben+python@benfinney.id.au> - 2011-06-06 09:01 +1000
  Re: Multiple windows services on the same machine Mark Hammond <skippy.hammond@gmail.com> - 2011-06-06 23:14 +1000

csiph-web