當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。