As described previously, most Python services will be a subclass of
class. This has a number of default
methods and helper methods to make writing services in Python easier:
The constructor for the class. This registers the method
ServiceCtrlHandler as the handler for notification
messages from the SCM.
Provides a default implementation of the service control handler.
This method interrogates the class for certain named methods to
determine which controls the service responds to. For example, if the
service contains a
SvcPause method, it’s
assumed the service can be paused.
A default implementation of the entry point for the service. This
method notifies the SCM that the service has started, calls a method
SvcDoRun, then when complete notifies the SCM the
service is stopping (PythonService.exe
automatically notifies the SCM that the service has stopped). Thus,
you need only provide a
SvcDoRun method in the
subclass that handles the functionality of your service.