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


Python win32serviceutil.HandleCommandLine方法代码示例

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


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

示例1: start

# 需要导入模块: import win32serviceutil [as 别名]
# 或者: from win32serviceutil import HandleCommandLine [as 别名]
def start(self):
        """Starting the daemon based on platform

        Returns:
            bool: start success

        """
        plat = platform.system().lower()
        if plat.startswith("win"):
            # Windows
            win32serviceutil.HandleCommandLine(AppServerSvc, argv=['grease', 'start'])
            return True
        elif plat.startswith("dar"):
            # MacOS
            if subprocess.call(["sudo", "launchctl", "load", "/Library/LaunchDaemons/net.grease.daemon.plist"]) != 0:
                return False
            return True
        elif plat.startswith("lin"):
            # Linux
            if subprocess.call(["sudo", "systemctl", "start", "grease"]) != 0:
                return False
            return True
        else:
            self.ioc.getLogger().error("Unrecognized operating system [{0}]".format(platform))
            return False 
开发者ID:target,项目名称:grease,代码行数:27,代码来源:DaemonCmd.py

示例2: stop

# 需要导入模块: import win32serviceutil [as 别名]
# 或者: from win32serviceutil import HandleCommandLine [as 别名]
def stop(self):
        """Stopping the daemon based on the platform

        Returns:
            bool: stop success

        """
        plat = platform.system().lower()
        if plat.startswith("win"):
            # Windows
            win32serviceutil.HandleCommandLine(AppServerSvc, argv=['grease', 'stop'])
            return True
        elif plat.startswith("dar"):
            if subprocess.call(["sudo", "launchctl", "unload", "/Library/LaunchDaemons/net.grease.daemon.plist"]) != 0:
                return False
            # MacOS
            return True
        elif plat.startswith("lin"):
            # Linux
            if subprocess.call(["sudo", "systemctl", "stop", "grease"]) != 0:
                return False
            return True
        else:
            self.ioc.getLogger().error("Unrecognized operating system [{0}]".format(platform))
            return False 
开发者ID:target,项目名称:grease,代码行数:27,代码来源:DaemonCmd.py

示例3: parse_command_line

# 需要导入模块: import win32serviceutil [as 别名]
# 或者: from win32serviceutil import HandleCommandLine [as 别名]
def parse_command_line(cls):
        '''
        ClassMethod to parse the command line
        '''
        win32serviceutil.HandleCommandLine(cls) 
开发者ID:frappe,项目名称:biometric-attendance-sync-tool,代码行数:7,代码来源:SMWinservice.py

示例4: windows_service

# 需要导入模块: import win32serviceutil [as 别名]
# 或者: from win32serviceutil import HandleCommandLine [as 别名]
def windows_service(service_args, res_circuits_args):
    """Register a windows service"""
    try:
        import win32serviceutil
        from resilient_circuits.bin import service_wrapper

        if res_circuits_args:
            # Set the command line arguments to pass to "resilient-circuits.exe run"
            service_wrapper.irms_svc.setResilientArgs(res_circuits_args)

        sys.argv = sys.argv[0:1] + service_args
        win32serviceutil.HandleCommandLine(service_wrapper.irms_svc)
    except ImportError:
        LOG.error("Requires PYWIN32 Package. Please download and install from: "
                  "https://sourceforge.net/projects/pywin32/files/pywin32/") 
开发者ID:ibmresilient,项目名称:resilient-python-api,代码行数:17,代码来源:resilient_circuits_cmd.py

示例5: __call_service_handler

# 需要导入模块: import win32serviceutil [as 别名]
# 或者: from win32serviceutil import HandleCommandLine [as 别名]
def __call_service_handler():
    def __ctrlHandler(ctrlType):
        return True
    
    
    from opsbro.windows_service.windows_service import Service
    win32api.SetConsoleCtrlHandler(__ctrlHandler, True)
    win32serviceutil.HandleCommandLine(Service) 
开发者ID:naparuba,项目名称:opsbro,代码行数:10,代码来源:cli.py

示例6: ctrlHandler

# 需要导入模块: import win32serviceutil [as 别名]
# 或者: from win32serviceutil import HandleCommandLine [as 别名]
def ctrlHandler(ctrlType):
    return True

# if __name__ == '__main__':
#    win32api.SetConsoleCtrlHandler(ctrlHandler, True)
#    win32serviceutil.HandleCommandLine(Service) 
开发者ID:naparuba,项目名称:opsbro,代码行数:8,代码来源:windows_service.py


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