Most likely you're not looking for the shutdown notification.  Try a google search on writing NT services.
Your service will be called asynchronously (in another thread) when the control manager wants your service to shutdown.  It's up to you to look for this event and break out of your processing loop when this occurs.
With py2exe, if you're sublcassing win32serviceutil.ServiceFramework, SvcStop is called when you need to shutdown. Normally you see something like this where a worker does the real 'work' of the service, you have to internally make sure that the worker is checking to see if it needs to quit and exit it's loop 
class MyService(win32serviceutil.ServiceFramework):
def __init__(self):
   worker = Worker()  #create a worker object to do the real work
def SvcStop(self):
   """windows wants you to stop the service"""
def SvcRun(self):
  """windows wants you to run the service"""
On 2/17/06, Brian Olsen <> wrote:
Sorry about this last message; it doesn't have my response which I was
going to CC to the list here.

> try posting some of your code,  But it sounds like your service is
> crashing.  Check the EventLog to see if there are any application
> messages.
> A common problem is using 'print' statements.  A windows service does not
> have a stdout, so if you are using 'print' statements it can crash.

I got it to sort of work; it now starts the service up properly, but now
it does not shut it down properly. I did not originally write it with
making it a service in mind, so I assume there is something in there that
is making it not cleanly shut down.

I am not in front of this code now, but I think this is just a silly
coding error on my part (hopefully.)


This email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
Py2exe-users mailing list