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