Python win32serviceutil.StopService() Examples
The following are 8
code examples of win32serviceutil.StopService().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
win32serviceutil
, or try the search function
.
Example #1
Source File: win32.py From opsbro with MIT License | 6 votes |
def signal_child(service, command): if command == 'stop': win32serviceutil.StopService(service) elif command == 'restart': win32serviceutil.RestartService(service) else: win32serviceutil.ControlService(service, control_codes[command])
Example #2
Source File: win32.py From cherrypy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def signal_child(service, command): if command == 'stop': win32serviceutil.StopService(service) elif command == 'restart': win32serviceutil.RestartService(service) else: win32serviceutil.ControlService(service, control_codes[command])
Example #3
Source File: platform_windows.py From scalyr-agent-2 with Apache License 2.0 | 5 votes |
def stop_agent_service(self, quiet): """Stops the agent service using the platform-specific method. This method must return only after the agent service has terminated. @param quiet: True if only error messages should be printed to stdout, stderr. @type quiet: bool """ try: if not quiet: print("Sending control signal to stop agent service.") win32serviceutil.StopService(_SCALYR_AGENT_SERVICE_) if not quiet: print("Agent service has stopped.") except win32api.error as e: if e[0] == winerror.ERROR_SERVICE_NOT_ACTIVE: raise AgentNotRunning( "The operating system indicates the Scalyr Agent Service is not running." ) elif e[0] == winerror.ERROR_SERVICE_DOES_NOT_EXIST: raise AgentNotRunning( "The operating system indicates the Scalyr Agent Service is not installed. " "This indicates a failed installation. Try reinstalling the agent." ) else: raise e
Example #4
Source File: recipe-135700.py From code with MIT License | 5 votes |
def svcStop( svc_name, machine=None): status = win32serviceutil.StopService( svc_name, machine)[1] while status == STOPPING: time.sleep(1) status = svcStatus( svc_name, machine) return status
Example #5
Source File: process.py From peach with Mozilla Public License 2.0 | 5 votes |
def _StopProcess(self): win32serviceutil.StopService(self.service, self.machine) while win32serviceutil.QueryServiceStatus(self.service, self.machine)[1] == 3: time.sleep(0.25) if win32serviceutil.QueryServiceStatus(self.service, self.machine)[1] != 1: raise Exception("WindowsService: Unable to stop service!")
Example #6
Source File: win32.py From bazarr with GNU General Public License v3.0 | 5 votes |
def signal_child(service, command): if command == 'stop': win32serviceutil.StopService(service) elif command == 'restart': win32serviceutil.RestartService(service) else: win32serviceutil.ControlService(service, control_codes[command])
Example #7
Source File: win32.py From Tautulli with GNU General Public License v3.0 | 5 votes |
def signal_child(service, command): if command == 'stop': win32serviceutil.StopService(service) elif command == 'restart': win32serviceutil.RestartService(service) else: win32serviceutil.ControlService(service, control_codes[command])
Example #8
Source File: win32.py From moviegrabber with GNU General Public License v3.0 | 5 votes |
def signal_child(service, command): if command == 'stop': win32serviceutil.StopService(service) elif command == 'restart': win32serviceutil.RestartService(service) else: win32serviceutil.ControlService(service, control_codes[command])