Hi all,
I use the attached program to start a win32 service.
Stopping the service using the service manager works fine, but when I
reboot the machine, the service just seems to be killed, without
SvcStop/SvcShutdown being called (i.e. it never prints "DONE" on reboot).
Tested on w2k using python2.3, and on XP using Python 2.4, both using
pywin 205.
Does anybody have an idea?
TIA,
- Ralf
#! /usr/bin/env python
import sys
import time
import win32serviceutil, win32service
class MyTwistedService(win32serviceutil.ServiceFramework):
_svc_name_ = 'AA'
_svc_display_name_ = 'AA'
def SvcDoRun(self):
# Can't use stdout for logging -- .flush will barf
sys.stdout = open('c:/mylog.txt','a', 0)
self.shouldStop = False
while not self.shouldStop:
print time.ctime(), "running"
time.sleep(1)
print "DONE"
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
self.shouldStop = True
SvcShutdown = SvcStop
if __name__ == '__main__':
win32serviceutil.HandleCommandLine(MyTwistedService)
_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32