Exemplo n.º 1
0
    def SvcDoRun(self):
        try:
            global LOG, DBIP, DBPort, _3ds, log, socksize, innerIP, CPUCores
            socksize = 64000
            _3ds = MyUtil._secret()
            cf1 = ConfigParser.ConfigParser()
            cf1.read(MyUtil.cur_file_dir() + "\\agent.ini")
            agentpath = cf1.get("main", "path").decode('gbk').encode("utf-8")
            agentlogfile = cf1.get(
                "main", "agentlogfile").decode('gbk').encode("utf-8")
            MyUtil.DBIP = cf1.get("main", "DBIP").decode('gbk').encode("utf-8")
            MyUtil.DBPort = cf1.get("main",
                                    "DBPort").decode('gbk').encode("utf-8")
            LOG = os.path.join(agentpath, agentlogfile)
            #创建日志实例
            log = MyUtil.CLogInfo(LOG)

            cf = ConfigParser.ConfigParser()
            cf.read(MyUtil.cur_file_dir() + "\\auto.ini")
            #强制读取配置文件中的IP地址设置,当前的问题是第一次必须手工更改配置文件中的IP,否则传出的IP错误
            innerIP = cf.get("Configuration",
                             "localip").decode('gbk').encode("utf-8")
            try:
                CPUCores = cf.get("Configuration",
                                  "cpucores").decode('gbk').encode("utf-8")
                CPUCores = int(CPUCores)
            except:
                CPUCores = int('1')

            rc = runCron()
            rc.run()
        except:
            #print "main Error:"+str(sys.exc_info()[0])+str(sys.exc_info()[1])
            pass
Exemplo n.º 2
0
        except:
            print u"initServerMap Error:"+str(sys.exc_info()[0])+str(sys.exc_info()[1])
            
        try:
            #从数据库中取出支持的命令列表            
            initCommandList("1")
        except:
            print u"initCommandList Error:"+str(sys.exc_info()[0])+str(sys.exc_info()[1])

        global UpdateServerIP,UpdateServerPort,CmdServerPort
        UpdateServerIP = cf.get("main", "UpdateServerIP")
        UpdateServerPort = cf.get("main", "UpdateServerPort")
        CmdServerPort = cf.get("main", "CmdServerPort")

        global LOG,log
        LOG = os.path.join(path,logfile)
        log = MyUtil.CLogInfo(LOG)
        
        print u"IOMServer Start.集中控制服务器启动"
        print version.__doc__
        print u"ServerIP:%s         PORT:%s"%(serverIP,port)  
        print u"DBServerIP:%s       PORT:%s"%(DBUtil.DBHost,DBUtil.DBPort)  
        print u"UpdateServerIP %s   PORT:%s"%(UpdateServerIP,UpdateServerPort)
        writeLog('IOMServer Start.集中控制服务器启动')
        srv = SocketServer.ThreadingTCPServer((serverIP, int(port)),IOMServer)
        srv.serve_forever()
        log.close()
    except:
        print "main Error:"+str(sys.exc_info()[0])+str(sys.exc_info()[1])
        writeLog("main Error:"+str(sys.exc_info()[0])+str(sys.exc_info()[1]))
        log.close()