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


Python win32serviceutil.ControlService方法代码示例

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


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

示例1: signal_child

# 需要导入模块: import win32serviceutil [as 别名]
# 或者: from win32serviceutil import ControlService [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: request_agent_status

# 需要导入模块: import win32serviceutil [as 别名]
# 或者: from win32serviceutil import ControlService [as 别名]
def request_agent_status(self):
        """Invoked by a process that is not the agent to request the current agent dump the current detail
        status to the status file.

        This is used to implement the 'scalyr-agent-2 status -v' feature.

        @return: If there is an error, an errno that describes the error.  errno.EPERM indicates the current does not
            have permission to request the status.  errno.ESRCH indicates the agent is not running.
        """
        try:
            win32serviceutil.ControlService(
                _SCALYR_AGENT_SERVICE_, _SERVICE_CONTROL_DETAILED_REPORT_
            )
        except win32api.error as e:
            if e[0] == winerror.ERROR_SERVICE_NOT_ACTIVE:
                return errno.ESRCH
            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,代码行数:25,代码来源:platform_windows.py


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