web-project 故障查看功能 检测是否启动fmd服务

def check_fmd_service():
    try:
        output = subprocess.check_output(svcs -H -o state fmd,shell=True)
        state = output.decode(UTF-8).strip()
        if state == online:
            return True
        elif state == disabled:
            subprocess.call(svcadm enable fmd,shell=True)
            log_debug(enable fmd svc.)
        elif state == maintenance:
            subprocess.call(svcadm clear fmd,shell=True)
            log_debug(clear fmd svc.)
            
        ‘‘‘wait‘‘‘
        for i in range(5):
            output = subprocess.check_output(svcs -H -o state fmd,shell=True)
            state = output.decode(UTF-8).strip()
            if state == online:
                return True
            time.sleep(1)
    except:
        pass
    
    log_debug(check and online fmd svc failed.)
    return False

 

web-project 故障查看功能 检测是否启动fmd服务,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。