当前位置: 首页>>代码示例>>Python>>正文


Python win32serviceutil.StopService方法代码示例

本文整理汇总了Python中win32serviceutil.StopService方法的典型用法代码示例。如果您正苦于以下问题:Python win32serviceutil.StopService方法的具体用法?Python win32serviceutil.StopService怎么用?Python win32serviceutil.StopService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在win32serviceutil的用法示例。


在下文中一共展示了win32serviceutil.StopService方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: signal_child

# 需要导入模块: import win32serviceutil [as 别名]
# 或者: from win32serviceutil import StopService [as 别名]
def signal_child(service, command):
    if command == 'stop':
        win32serviceutil.StopService(service)
    elif command == 'restart':
        win32serviceutil.RestartService(service)
    else:
        win32serviceutil.ControlService(service, control_codes[command]) 
开发者ID:cherrypy,项目名称:cherrypy,代码行数:9,代码来源:win32.py

示例2: stop_agent_service

# 需要导入模块: import win32serviceutil [as 别名]
# 或者: from win32serviceutil import StopService [as 别名]
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 
开发者ID:scalyr,项目名称:scalyr-agent-2,代码行数:28,代码来源:platform_windows.py

示例3: svcStop

# 需要导入模块: import win32serviceutil [as 别名]
# 或者: from win32serviceutil import StopService [as 别名]
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 
开发者ID:ActiveState,项目名称:code,代码行数:8,代码来源:recipe-135700.py

示例4: _StopProcess

# 需要导入模块: import win32serviceutil [as 别名]
# 或者: from win32serviceutil import StopService [as 别名]
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!") 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:8,代码来源:process.py


注:本文中的win32serviceutil.StopService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。