-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, 27 June 2001 4:01 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: AW: How to start/stop/check a serviceHi,
I successfully used your script to start/stop/restart a Cold Fusion Server service on an NT4 machine.
Especially the restart feature is nice as it is not available in the NT4 service manager.But, I would like to start/stop the service on a remote machine.
Is there a way to specify the remote machine on the command line so that win32serviceutil.HandleCommandLine passes this properly to the request handlers depending on the action?Also, I did not find an option to check the status of a service using HandleCommandLine.
It would be nice not having to write an own implementation of this command line argument handler.Peter
-----Ursprüngliche Nachricht-----
Von: Andrew Chabokha [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 21. Juni 2001 21:16
An: Robin Siebler; [EMAIL PROTECTED]
Betreff: Re: How to start/stop/check a service
# ts1.py
# Test service
#import win32serviceutil
import win32service
import win32eventclass TService(win32serviceutil.ServiceFramework):
... <cut/>
if __name__ == '__main__':
win32serviceutil.HandleCommandLine(TService)
Title: AW: How to start/stop/check a service
win32serviceutil.HandleCommandLine() is a helper function used for
services implemented in Python, and to use used as an aid during development of
the servicei. As such, it only supports the current
machine.
However, all this functionality is available in the other
win32serviceutil functions - eg, a single line:
>>> win32serviceutil.StartService(service_name, None,
machine_name)
will
do what you want. win32serviceutil.QueryServiceStatus() can check the
status.
HandleCommandLine() is not supposed to be a general purpose interface for
all service functions anyone may wish to perform. As it is possible to
perform all the same functions with a single line of code, I don't think it work
making HandleCommandLine more complex.
If you
come up with patches that you think are reasonable and don't add too much
complexity I would be happy to consider adding them - eg, I could see that a new
command-line param "query" may make sense to show the service
state.
Mark.
- How to start/stop/check a service Robin Siebler
- Re: How to start/stop/check a service Andrew Chabokha
- Mark Hammond