Beispiel #1
0
 def modifyBackstage(self):
     header = {"host":self.backstage_header}
     data = {}
     data["servername"] = "%s_S%s"%(self.yx,self.quhao)
     data["n_ip"] = self.ip
     data["w_ip"] = self.dianxinIp
     data["cnc_ip"] = self.liantongIp
     result = backstage.upBackstage(self.backstage_interface_url,data,header)
     if result["status"]:
         print "后台修改成功!"
     else:
         print "后台修改失败!" + result["msg"]
Beispiel #2
0
 def modifyBackstage(self,yx,quhao):
     header = {"host":self.backstage_header}
     data = {}
     data["servername"] = "%s_S%s"%(yx,quhao)
     data["n_ip"] = self.ip
     data["w_ip"] = self.dianxinIp
     data["cnc_ip"] = self.liantongIp
     result = backstage.upBackstage(self.backstage_interface_url,data,header)
     if result["status"]:
         print "后台修改成功!"
     else:
         print "后台修改失败!" + result["msg"]
Beispiel #3
0
def backstageChange():
    print allservers
    for server in allservers:
        print allservers[server]
        if int(allservers[server]["mixflag"]) == 1:
            data = {}
            data["servername"] = allservers[server]["servername"].replace("_","_S")
            data["n_ip"] = recoverIp
            data["w_ip"] = dianxinIp
            data["cnc_ip"] = liantongIp
            result = backstage.upBackstage(backstage_interface_url,data,header)
            if result["status"]:
                print "%s 修改后台成功!"%server
            else:
                print "%s 修改后台失败!MSG:%s"%(server,result["msg"])
    pass
Beispiel #4
0
def backstageChange():
    print allservers
    for server in allservers:
        print allservers[server]
        if int(allservers[server]["mixflag"]) == 1:
            data = {}
            data["servername"] = allservers[server]["servername"].replace(
                "_", "_S")
            data["n_ip"] = recoverIp
            data["w_ip"] = dianxinIp
            data["cnc_ip"] = liantongIp
            result = backstage.upBackstage(backstage_interface_url, data,
                                           header)
            if result["status"]:
                print "%s 修改后台成功!" % server
            else:
                print "%s 修改后台失败!MSG:%s" % (server, result["msg"])
    pass
Beispiel #5
0
def backstageChange(server,ip):
    wip = getip.getServerWip(ip)
    if len(wip) == 0:
        print "%s %s 获取外网失败!"%(server,ip)
        return 
    elif len(wip) == 1:
        dianxinIp = wip[0]
        liantongIp = dianxinIp
    else:
        dianxinIp = wip[0]
        liantongIp = wip[1]
    if int(allservers[server]["mixflag"]) == 1:
        data = {}
        data["servername"] = allservers[server]["servername"].replace("_","_S")
        data["n_ip"] = ip
        data["w_ip"] = dianxinIp
        data["cnc_ip"] = liantongIp
        backstageHeader = {"host":header}
        result = backstage.upBackstage(backstage_interface_url,data,backstageHeader)
        if result["status"]:
            print "%s 修改后台成功!"%server
        else:
            print "%s 修改后台失败!MSG:%s"%(server,result["msg"])
    pass
Beispiel #6
0
    except Exception, e1:
        if str(e1).find("no crontab for astd") < 0:
            raise e1
    backupCrontab = "/app/opbak/crontab/%s" % state.game
    cmd("mkdir -p %s" % backupCrontab)
    cmd("cp %s %s/" % (tmpfile, backupCrontab))
    cmd("mkdir -p /app/opbin/%s/allinone/logs/" % state.game)
    cmd('sed -i "/\\/app\\/opbin\\/%s\\/allinone\\/shell\\/%s\\s*\'%s\'\\s*\'%s\'/d" %s'
        % (state.game, clearshell, state.game, server, tmpfile))
    cronttime = cleartime_datetime.strftime("%M %H %d %m")
    cmd('echo "%s * sh /app/opbin/%s/allinone/shell/%s \'%s\' \'%s\' \'%s\' \'%s\' \'%s\' \'%s\' &>/app/opbin/%s/allinone/logs/clear_%s_info.log" >> %s'
        % (cronttime, state.game, clearshell, state.game, server,
           state.language, gameOption("www_ip"), gameOption("www_port"),
           gameOption("www_header"), state.game, server, tmpfile))
    cmd("crontab %s" % tmpfile)
    cmd("rm -f %s" % tmpfile)
    cmd('crontab -l | grep "%s.*\'%s\'"' % (clearshell, server))
    houtaiStarttime = (
        datetime.datetime.strptime(starttime, "%Y-%m-%d %H:%M:%S") -
        datetime.timedelta(minutes=30)).strftime("%Y-%m-%d %H:%M:%S")
    data = {}
    data["servername"] = server.replace("_", "_S")
    data["start_time"] = houtaiStarttime
    header = {"host": gameOption("backstage_header")}
    backstage_interface_url = gameOption("backstage_interface_url")
    houtai = backstage.upBackstage(backstage_interface_url, data, header)
    if houtai["status"]:
        print "后台修改成功"
    else:
        raise Exception("后台修改失败!msg:%s" % houtai["msg"])
Beispiel #7
0
    print clearshell
    cmd("mkdir -p /app/opbin/%s/allinone/shell/"%state.game)
    sshobj.put("%s/../shell/%s"%(os.path.abspath(os.path.dirname(__file__)),clearshell),remote_path="/app/opbin/%s/allinone/shell/"%state.game)
    tmpfile = "/tmp/crontab_%s"%datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
    try:
        cmd("crontab -l > %s"%tmpfile)
    except Exception,e1:
        if str(e1).find("no crontab for astd") < 0:
            raise e1
    backupCrontab = "/app/opbak/crontab/%s"%state.game
    cmd("mkdir -p %s"%backupCrontab)
    cmd("cp %s %s/"%(tmpfile,backupCrontab))
    cmd("mkdir -p /app/opbin/%s/allinone/logs/"%state.game)
    cmd('sed -i "/\\/app\\/opbin\\/%s\\/allinone\\/shell\\/%s\\s*\'%s\'\\s*\'%s\'/d" %s'%(state.game,clearshell,state.game,server,tmpfile))
    cronttime = cleartime_datetime.strftime("%M %H %d %m")
    cmd('echo "%s * sh /app/opbin/%s/allinone/shell/%s \'%s\' \'%s\' \'%s\' \'%s\' \'%s\' \'%s\' &>/app/opbin/%s/allinone/logs/clear_%s_info.log" >> %s'%(cronttime,state.game,clearshell,state.game,server,state.language,gameOption("www_ip"),gameOption("www_port"),gameOption("www_header"),state.game,server,tmpfile))
    cmd("crontab %s"%tmpfile)
    cmd("rm -f %s"%tmpfile)
    cmd('crontab -l | grep "%s.*\'%s\'"'%(clearshell,server))
    houtaiStarttime = (datetime.datetime.strptime(starttime,"%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes = 30)).strftime("%Y-%m-%d %H:%M:%S")
    data = {}
    data["servername"] = server.replace("_","_S")
    data["start_time"] = houtaiStarttime
    header = {"host":gameOption("backstage_header")}
    backstage_interface_url = gameOption("backstage_interface_url")
    houtai = backstage.upBackstage(backstage_interface_url,data,header)
    if houtai["status"]:
        print "后台修改成功"
    else:
        raise Exception("后台修改失败!msg:%s"%houtai["msg"])