• 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
  • 相关阅读:
    MOXA串口服务器使用
    【笔记】Winform设置快捷键
    comboBox联动
    【笔记】winform窗体显示
    关于xml文件的使用
    day_6
    day_5
    dau_4
    day_3
    day_2
  • 原文地址:https://www.cnblogs.com/fendou-999/p/3811860.html
Copyright © 2020-2023  润新知