[python-win32] Service does not start at windows boot but at user's login

Mark Hammond mhammond at skippinet.com.au
Wed Jun 4 15:17:39 CEST 2008


XP and Vista both pull a few tricks to get you logged on before all services
have started - there are no guarantees that all services will be started
before any user programs.  It's probably best to just have your client deal
with the situation (either by blindly, but smartly, retrying, or by querying
the service status and waiting until it is reporting it is started.)

Cheers,

Mark


> -----Original Message-----
> From: python-win32-bounces at python.org [mailto:python-win32-
> bounces at python.org] On Behalf Of stephane.poirot
> Sent: Wednesday, 4 June 2008 10:29 PM
> To: python-win32 at python.org
> Subject: [python-win32] Service does not start at windows boot but at
> user's login
> 
> Good morning,
> 
> I'm currently building an application which involves two different
> processes : one is a service and the other one is a simple client.
> My client starts at user's login and the service should start at
> windows
> boot. I say 'should' because it seems that the service
> actually starts at user's login too : I put logs in the event log and I
> noticed that the service starts almost 7 to 10 seconds after
> the client, which is not what is expected. Service's properties are :
> run automatically on System account, no dependencies.
> The code of my service is based on the one found in the book : Oreilly,
> Python Programming on Win32, at chapter 18.6 :
> Sample Service Written in Python.
> 
> 
> Furthermore, my two processes communicate through a named pipe, and the
> problem aforementioned involves that the communication
> is not possible : indeed, the service, who should start before the
> client, creates the pipe and waits for a client connection. Client has
> just
> to open  the pipe to connect. But obviously if the client starts before
> the service, an error occurs because no pipe is created so far.
> 
> I did a lot of searches to solve this problem, but haven't found any
> issue yet.
> I first thought that  the problem came from pythonservice.exe, which
> hosts my service : it may take longer time
> to load than common other windows services. That's why I converted my
> service into a .exe thanks to py2exe. Then the path in service's
> properties has changed to this executable. But the problem remains :
> service still starts after client.
> However, the problem only occurs at first user's login after machine's
> boot : if he disconnects and somebody connects after, without reboot,
> the service is
> still running, which is normal.
> 
> That's why I would ask if anyone  has an idea for solving this problem.
> Thank you in advance for your answers.
> 
> Stéphane POIROT
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32



More information about the python-win32 mailing list