示例#1
0
def __load_project_file(options):
    jname = 'poker/project.json'
    datadict = __load_json_file(options, jname, list)

    if not datadict:
        return datadict

    game_packages = []
    gameids = []

    for proj in datadict:
        ppath = proj.get('path', None)
        if not isinstance(ppath, str):
            return actlog.error('the project path is not defined !', proj)
        if not fsutils.dirExists(ppath):
            return actlog.error('the project path not found !', ppath)

        srcpath = fsutils.appendPath(ppath, 'src')
        if fsutils.dirExists(srcpath):
            subdirs = os.listdir(srcpath)
            for subdir in subdirs:
                gamepy = fsutils.appendPath(srcpath, subdir, 'game.py')
                if fsutils.fileExists(gamepy):
                    if subdir in game_packages:
                        return actlog.error(
                            'the project package is double defined !', gamepy,
                            'proj=', proj)
                    game_packages.append(subdir)
                    proj['package'] = subdir
                    gameid = proj.get('gameId', 0)
                    if gameid > 0:
                        gameids.append(int(gameid))
                    actlog.log('find gam project-> GAMEID=', gameid,
                               'PACKAGE=', subdir)
    return datadict, game_packages, gameids
示例#2
0
def action(options):
    '''
    生成所有的进程启动脚本
    '''
    bin_path = options.env['bin_path']
    config_redis = options.pokerdict.get('local_config_redis',
                                         options.pokerdict['config_redis'])
    remotepy = loadResource('remote.py')
    remotepy = remotepy.replace('${TIME}', str(datetime.now()))
    remotepy = remotepy.replace('${BIN_PATH}', bin_path)
    remotepy = remotepy.replace('${LOG_PATH}', options.env['log_path'])
    remotepy = remotepy.replace('${REDIS_CONFIG}', config_redis)

    cfilepath = fsutils.appendPath(bin_path, 'remote.py')
    fsutils.writeFile('', cfilepath, remotepy)

    if options.pokerdict['mode'] <= 2:
        sendmail = '1'
    else:
        sendmail = '0'

    while1sh = loadResource('while1.sh')
    while1sh = while1sh.replace('${SENDMAIL}', sendmail)
    while1sh = while1sh.replace('${BIN_PATH}', bin_path)
    while1sh = while1sh.replace('${LOG_PATH}', options.env['log_path'])

    if os.environ.get('RUN_IN_DOCKER', 0):
        # 在开发docker模式下,设置PYTHONPATH环境变量
        paths = []
        for proj in options.projectlist:
            src = fsutils.appendPath(proj['path'], 'src')
            if fsutils.dirExists(src):
                paths.append(src)
            else:
                src = fsutils.appendPath(proj['path'], 'freetime')
                if fsutils.dirExists(src):
                    paths.append(proj['path'])
        paths.reverse()
        paths = ':'.join(paths)
        while1sh = while1sh.replace('${DOCKER_PROJECT_PATH}', paths)
        actlog.log('makeControlInDocker PYTHONPATH=', paths)

    shfile = fsutils.appendPath(bin_path, 'while1.sh')
    fsutils.writeFile('', shfile, while1sh)
    os.chmod(shfile, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    return 1
示例#3
0
def action(options):
    '''
    生成所有的进程启动脚本
    '''
    bin_path = options.env['bin_path']
    config_redis = options.pokerdict.get('local_config_redis', options.pokerdict['config_redis'])
    remotepy = loadResource('remote.py')
    remotepy = remotepy.replace('${TIME}', str(datetime.now()))
    remotepy = remotepy.replace('${BIN_PATH}', bin_path)
    remotepy = remotepy.replace('${LOG_PATH}', options.env['log_path'])
    remotepy = remotepy.replace('${REDIS_CONFIG}', config_redis)

    cfilepath = fsutils.appendPath(bin_path, 'remote.py')
    fsutils.writeFile('', cfilepath, remotepy)

    if options.pokerdict['mode'] <= 2 :
        sendmail = '1'
    else:
        sendmail = '0'

    while1sh = loadResource('while1.sh')
    while1sh = while1sh.replace('${SENDMAIL}', sendmail)
    while1sh = while1sh.replace('${BIN_PATH}', bin_path)
    while1sh = while1sh.replace('${LOG_PATH}', options.env['log_path'])

    if os.environ.get('RUN_IN_DOCKER', 0):
        # 在开发docker模式下,设置PYTHONPATH环境变量
        paths = []
        for proj in options.projectlist:
            src = fsutils.appendPath(proj['path'], 'src')
            if fsutils.dirExists(src):
                paths.append(src)
            else:
                src = fsutils.appendPath(proj['path'], 'freetime')
                if fsutils.dirExists(src):
                    paths.append(proj['path'])
        paths.reverse()
        paths = ':'.join(paths)
        while1sh = while1sh.replace('${DOCKER_PROJECT_PATH}', paths)
        actlog.log('makeControlInDocker PYTHONPATH=', paths)

    shfile = fsutils.appendPath(bin_path, 'while1.sh')
    fsutils.writeFile('', shfile, while1sh)
    os.chmod(shfile, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)

    return 1
示例#4
0
文件: main.py 项目: zhaozw/hall37
def main():
    from optparse import OptionParser
    from tyserver.tyutils import fsutils
    
    parser = OptionParser(version="%prog 1.0", usage="%prog --path entrancepath --port Num")  
    parser.add_option("--path", dest="pokerpath", default=None,
                      help="must specified the service entrance path, the poker.json's path")  
    parser.add_option("--httpport", dest="httpport", default=None,
                      help="the http port")  

    options, _ = parser.parse_args()
    pokerpath = options.pokerpath
    if not pokerpath :
        print "must specified the service entrance path"
        parser.print_help()
        return None

    pokerpath = fsutils.makeAsbpath(options.pokerpath)
    if not fsutils.dirExists(pokerpath) :
        print "the service entrance path not exists [" + pokerpath + ']'
        parser.print_help()
        return None

    setattr(options, 'pokerpath', pokerpath)

    port = options.httpport
    try:
        port = int(options.httpport)
        setattr(options, 'httpport', port)
    except:
        print "the http port must be a integer"
        parser.print_help()
        return

    workpath = fsutils.getParentDir(__file__, 1)
    setattr(options, 'workpath', workpath)

    fpath = os.environ.get('LOGDIR', '')
    if not fpath :
        fpath = fsutils.appendPath(workpath, './../logs')
        fpath = fsutils.abspath(fpath)
        fsutils.makeDirs(fpath)
    setattr(options, 'logpath', fpath)

    print "pokerpath =", options.pokerpath
    print "httpport  =", options.httpport
    print "workpath  =", options.workpath

    flogfile = fsutils.appendPath(fpath, 'webmagr.log') 
    setattr(options, 'logfile', flogfile)

    from tyserver.server import startup
    from webmgr.manager import initialize, heartbeat
    setattr(options, 'initialize', initialize)
    setattr(options, 'heartbeat', heartbeat)
    startup(options)
示例#5
0
def make_static_json_file(options, alldata):
    confs = {}
    _load_decorations(options, confs, alldata)
    _load_activity(options, confs, alldata)
    _load_gamelist2(options, confs, alldata)
    webroot = options.env['webroot_path'] + '/static_file/'
    staticjson = webroot + 'static.json'
    if not fsutils.dirExists(webroot):
        fsutils.makeDirs(webroot)
    fsutils.writeFile('', staticjson, confs)
    _remake_static_zip(options, confs, alldata)
    return 1
示例#6
0
def make_static_json_file(options, alldata):
    confs = {}
    _load_decorations(options, confs, alldata)
    _load_activity(options, confs, alldata)
    _load_gamelist2(options, confs, alldata)
    webroot = options.env['webroot_path'] + '/static_file/'
    staticjson = webroot + 'static.json'
    if not fsutils.dirExists(webroot) :
        fsutils.makeDirs(webroot)
    fsutils.writeFile('', staticjson, confs)
    _remake_static_zip(options, confs, alldata)
    return 1
示例#7
0
def action(options):
    '''
    拷贝源代码工程的webroot到编译输出目录,按照配置文件的工程列表进行顺序覆盖拷贝
    '''
    actlog.log('copy webroot to bin/webroot')

    if os.environ.get('RUN_IN_DOCKER', 0):
        # 在开发docker模式下,webroot为link模式,无需拷贝
        actlog.log('docker mode skip this step !')
        return 1

    allpaths = [
        options.env['webroot_path'],
        options.env['backup_path'],
    ]
    for mp in allpaths:
        fsutils.makePath(mp, False)

    paths = []
    for proj in options.projectlist:
        src = fsutils.appendPath(proj['path'], 'webroot')
        if fsutils.dirExists(src):
            paths.append({
                'path': src,
                'include': [],
                'exclude': [".*\\.svn\\.*", ".*pyc"]
            })

    if options.pokerdict['mode'] in (1, 2):
        fsutils.copyTree(paths, options.env['webroot_path'], logfun=actlog.log)
        return 1

    # MODE 3, 4: 只链接, 并且只链接 tygame-webroot/webroot
    dstpath = options.env['webroot_path']
    for pathconf in paths:
        if 'tygame-webroot' in pathconf['path']:
            srcpath = pathconf['path']
            if os.path.islink(dstpath):
                if os.readlink(dstpath) == srcpath:  # 已经链接好了
                    actlog.log('already linked.', dstpath, '->', srcpath)
                    return 1
            fsutils.deletePath(dstpath)
            os.symlink(srcpath, dstpath)
            actlog.log('symlink created.', dstpath, '->', srcpath)
            return 1
    else:
        fsutils.copyTree(paths, options.env['webroot_path'], logfun=actlog.log)
    return 1
示例#8
0
def action(options):
    '''
    拷贝源代码工程的webroot到编译输出目录,按照配置文件的工程列表进行顺序覆盖拷贝
    '''
    actlog.log('copy webroot to bin/webroot')

    if os.environ.get('RUN_IN_DOCKER', 0) :
        # 在开发docker模式下,webroot为link模式,无需拷贝
        actlog.log('docker mode skip this step !')
        return 1

    allpaths = [
                options.env['webroot_path'],
                options.env['backup_path'],
    ]
    for mp in allpaths:
        fsutils.makePath(mp, False)

    paths = []
    for proj in options.projectlist :
        src = fsutils.appendPath(proj['path'], 'webroot')
        if fsutils.dirExists(src) :
            paths.append({'path':src, 'include' : [], 'exclude' : [".*\\.svn\\.*", ".*pyc"]})

    if options.pokerdict['mode'] in (1, 2):
        fsutils.copyTree(paths, options.env['webroot_path'], logfun=actlog.log)
        return 1

    # MODE 3, 4: 只链接, 并且只链接 tygame-webroot/webroot
    dstpath = options.env['webroot_path']
    for pathconf in paths:
        if 'tygame-webroot' in pathconf['path']:
            srcpath = pathconf['path']
            if os.path.islink(dstpath):
                if os.readlink(dstpath) == srcpath:  # 已经链接好了
                    actlog.log('already linked.', dstpath, '->', srcpath)
                    return 1
            fsutils.deletePath(dstpath)
            os.symlink(srcpath, dstpath)
            actlog.log('symlink created.', dstpath, '->', srcpath)
            return 1
    else:
        fsutils.copyTree(paths, options.env['webroot_path'], logfun=actlog.log)
    return 1
示例#9
0
def action(options):
    """
    拷贝源代码工程的etc、src、src-robot、webroot到编译输出目录,按照配置文件的工程列表进行顺序覆盖拷贝
    """
    # 创建所有的路径
    allpaths = [
        options.env['log_path'],
        options.env['webroot_path'],
        options.env['backup_path'],
    ]
    for mp in allpaths:
        fsutils.makePath(mp, False)
    allpaths = [
        options.env['bin_path']
    ]
    for mp in allpaths:
        fsutils.makePath(mp, True)

    if os.environ.get('RUN_IN_DOCKER', 0):
        # 在开发docker模式下,webroot为link模式,无需拷贝
        copySourceInDocker(options)
        actlog.log('docker mode use original project src path !')
        return 1

    paths = []
    for proj in options.projectlist:
        src = fsutils.appendPath(proj['path'], 'src')
        if fsutils.dirExists(src):
            paths.append({'path': src, 'include': [], 'exclude': [".*\\.svn\\.*", ".*pyc"]})
        else:  # freetime project
            paths.append({'path': proj['path'],
                          "include": ["^/freetime/.*"],
                          "exclude": [".*\\.svn\\.*",
                                      ".*pyc",
                                      ".*\\logserver\\.*",
                                      ".*\\cold-data-server\\.*"]})

    if ide_debug():
        _, copy_files = fsutils.linkTree(paths, options.env['bin_path'], logfun=actlog.log)
    else:
        _, copy_files = fsutils.copyTree(paths, options.env['bin_path'], logfun=actlog.log)
    setattr(options, '_pyfiles', copy_files)

    return 1
示例#10
0
文件: game.py 项目: zhaozw/hall37
def main():
    from tyserver.tyutils import fsutils
    actlog._with_std = 1

    options = parse_cmd_lines()
    if not hasattr(options, 'pokerpath'):
        useage()
        actlog.log('You must input -m <poker path>')
        return
    if not hasattr(options, 'action'):
        useage()
        actlog.log('You Must input -a <action>')
        return

    pokerpath = options.pokerpath
    if not pokerpath:
        actlog.log("must specified the service entrance path")
        useage()
        return None

    pokerpath = fsutils.makeAsbpath(options.pokerpath)
    if not fsutils.dirExists(pokerpath):
        actlog.log("the service entrance path not exists [" + pokerpath + ']')
        useage()
        return None

    setattr(options, 'pokerpath', pokerpath)

    workpath = fsutils.getParentDir(__file__, 1)
    setattr(options, 'workpath', workpath)

    fpath = os.environ.get('LOGDIR', '')
    if fpath and fsutils.dirExists(fpath):
        fpath = fsutils.abspath(fpath)
        setattr(options, 'logpath', fpath)
        ct = datetime.now().strftime('%Y%m%d%H%M%S')
        actlog.open_act_log(options, {'uuid': ct})
    else:
        setattr(options, 'logpath', None)

    actlog.log("pokerpath =", options.pokerpath)
    actlog.log("workpath  =", options.workpath)
    actlog.log("logpath   =", options.logpath)

    flogfile = fsutils.appendPath(fpath, 'webmagr.log')
    setattr(options, 'logfile', flogfile)

    actlog.log("action    =", options.action)
    if options.action == 'config_check':
        action = {'action': 'config_check', 'params': {}}
        thread_do_action(options, action)
        return

    if options.action == 'config_reload':
        action = {'action': 'config_reload', 'params': {}}
        thread_do_action(options, action)
        return

    if options.action == 'config_update':
        keys = []
        if hasattr(options, 'keys'):
            keys = options.keys.split(',')
        action = {'action': 'config_update', 'params': {'keys': keys}}
        thread_do_action(options, action)
        return

    if options.action == 'config_reset':
        action = {'action': 'config_update', 'params': {'reset': 1}}
        thread_do_action(options, action)
        return

    if options.action == 'config_status':
        action = {'action': 'config_status', 'params': {}}
        thread_do_action(options, action)
        return

    if options.action == 'compile':
        action = {'action': 'compile_source', 'params': {}}
        thread_do_action(options, action)
        return

    if options.action == 'start':
        action = {'action': 'config_compile_start', 'params': {}}
        thread_do_action(options, action)
        return

    if options.action == 'reset':
        if not hasattr(options, 'serverIds'):
            useage()
            actlog.log('You must input -sid XXX,XXX')
            return
        processids = options.serverIds.split(',')
        if not processids:
            useage()
            actlog.log('You must input -sid XXX,XXX')
            return
        action = {'action': 'reset', 'params': {'processids': processids}}
        thread_do_action(options, action)
        return

    if options.action == 'stop':
        action = {'action': 'stop_all_process', 'params': {}}
        thread_do_action(options, action)
        return

    if options.action == 'push_code':
        action = {'action': 'push_bin', 'params': {}}
        thread_do_action(options, action)
        return

    if options.action == 'push_web':
        action = {'action': 'push_web', 'params': {}}
        thread_do_action(options, action)
        return

    hotfixwait = 1
    if options.action == 'hotfix_nowait':
        options.action = 'hotfix'
        hotfixwait = 0
    setattr(options, 'hotfixwait', hotfixwait)

    if options.action == 'hotfix':
        if not hasattr(options, 'serverIds'):
            useage()
            actlog.log('You must input -sid XXX,XXX or -sid all')
            return
        if not hasattr(options, 'hotfixpy'):
            useage()
            actlog.log('You Must input -py xxxx.py')
            return
        hotfix.action(options)
        return

    if options.action == 'rm_logs':
        action = {'action': 'remove_all_logs', 'params': {}}
        thread_do_action(options, action)
        return

    actlog.log('unknow action of :', options.action)
    useage()
示例#11
0
def __load_poker_file(options):
    pokerfile = options.pokerfile
    actlog.log('LOAD POKER FILE      :', pokerfile)
    pokerdict = fsutils.readJsonFile(pokerfile, True)
    pokerdict['poker_path'] = options.poker_path

    if not isinstance(pokerdict, dict):
        return actlog.error('POKER FILE : format error,must be a dict')

    gameId = pokerdict.get('id', None)
    if not isinstance(gameId, int) or gameId <= 0 or gameId >= 10000:
        return actlog.error('POKER FILE : id value is wrong')

    gameName = pokerdict.get('name', None)
    if not isinstance(gameName, (str, unicode)) or len(gameName) <= 0:
        return actlog.error('POKER FILE : name value is wrong')
    if gameName.find('-') >= 0:
        return actlog.error(
            'POKER FILE : name value is wrong, can not have "-" (reserved char)'
        )

    corporation = pokerdict.get('corporation', 'tuyoo')
    if corporation not in ('tuyoo', 'momo'):
        return actlog.error(
            'POKER FILE : corporation value wrong, choice: tuyoo or momo')
    pokerdict['corporation'] = corporation

    mode = pokerdict.get('mode', 0)
    if mode not in (1, 2, 3, 4):
        return actlog.error(
            'POKER FILE : mode value must be an integer, choice : 1(online) or 2(simulation) or 3(rich test) or 4(tiny test)'
        )

    port_redis = pokerdict.get('port_redis', 0)
    if not actutils.check_port(port_redis, True):
        return actlog.error(
            'POKER FILE : port_redis, socket port number wrong ' +
            str(port_redis))
    pokerdict['port_redis'] = port_redis

    local_internet = pokerdict.get('local_internet', '')
    if not isinstance(local_internet, (str, unicode)):
        return actlog.error('POKER FILE : local_internet value is wrong')
    pokerdict['local_internet'] = local_internet

    local_intranet = __get_value(pokerdict, 'local_intranet', None)
    if not isinstance(local_intranet, (str, unicode)):
        return actlog.error('POKER FILE : local_intranet value is wrong')
    pokerdict['local_intranet'] = local_intranet

    port_http = int(__get_value(pokerdict, 'port_http', 0))
    if not actutils.check_port(port_http, True):
        return actlog.error(
            'POKER FILE : port_http, socket port number wrong ' +
            str(port_http))
    pokerdict['port_http'] = port_http

    projects_path = __get_value(pokerdict, 'projects_path', None)
    if not isinstance(projects_path, str):
        return actlog.error(
            'POKER FILE : projects_path wrong, must pointing to the projects path'
        )
    projects_path = fsutils.makeAsbpath(projects_path, pokerfile)
    if not fsutils.dirExists(projects_path):
        return actlog.error(
            'POKER FILE : projects_path, the path not exists [' +
            projects_path + ']')
    pokerdict['projects_path'] = projects_path

    output_path = __get_value(pokerdict, 'output_path', None)
    if not isinstance(output_path, str):
        return actlog.error(
            'POKER FILE : output_path wrong, must pointing to the compile output path'
        )
    output_path = fsutils.makeAsbpath(output_path, pokerfile)
    if not fsutils.dirExists(output_path):
        return actlog.error(
            'POKER FILE : output_path wrong, the path not exists [' +
            output_path + ']')
    pokerdict['output_path'] = output_path

    http = __get_value(pokerdict, 'http_sdk', '')
    if not actutils.check_http_url(http, 'POKER FILE : http_sdk'):
        return 0
    pokerdict['http_sdk'] = http

    http = __get_value(pokerdict, 'http_sdk_inner', None)
    if http != None and not actutils.check_http_url(
            http, 'POKER FILE : http_sdk_inner'):
        return 0
    pokerdict['http_sdk_inner'] = http

    http = __get_value(pokerdict, 'http_game', None)
    if http != None and not actutils.check_http_url(http,
                                                    'POKER FILE : http_game'):
        return 0
    pokerdict['http_game'] = http

    http = __get_value(pokerdict, 'http_download', None)
    if http != None and not actutils.check_http_url(
            http, 'POKER FILE : http_download'):
        return 0
    pokerdict['http_download'] = http

    http = __get_value(pokerdict, 'http_gdss', None)
    if http != None and not actutils.check_http_url(http,
                                                    'POKER FILE : http_gdss'):
        return 0
    pokerdict['http_gdss'] = http

    config_redis = __get_value(pokerdict, 'config_redis', None)
    if not isinstance(config_redis, str):
        return actlog.error(
            'POKER FILE : config_redis wrong, must pointing to the configure redis <ip>:<port>:<dbid>'
        )
    confdb = config_redis.split(':')
    if len(confdb) != 3:
        return actlog.error(
            'POKER FILE : config_redis wrong, must pointing to the configure redis <ip>:<port>:<dbid>'
        )
    pokerdict['config_redis'] = config_redis

    return pokerdict
示例#12
0
文件: game.py 项目: zhaozw/hall37
def main():
    from tyserver.tyutils import fsutils
    actlog._with_std = 1

    options = parse_cmd_lines()
    if not hasattr(options, 'pokerpath') :
        useage()
        actlog.log('You must input -m <poker path>')
        return
    if not hasattr(options, 'action') :
        useage()
        actlog.log('You Must input -a <action>')
        return

    pokerpath = options.pokerpath
    if not pokerpath :
        actlog.log("must specified the service entrance path")
        useage()
        return None

    pokerpath = fsutils.makeAsbpath(options.pokerpath)
    if not fsutils.dirExists(pokerpath) :
        actlog.log("the service entrance path not exists [" + pokerpath + ']')
        useage()
        return None

    setattr(options, 'pokerpath', pokerpath)

    workpath = fsutils.getParentDir(__file__, 1)
    setattr(options, 'workpath', workpath)

    fpath = os.environ.get('LOGDIR', '')
    if fpath and fsutils.dirExists(fpath):
        fpath = fsutils.abspath(fpath)
        setattr(options, 'logpath', fpath)
        ct = datetime.now().strftime('%Y%m%d%H%M%S')
        actlog.open_act_log(options, {'uuid':ct})
    else:
        setattr(options, 'logpath', None)

    actlog.log("pokerpath =", options.pokerpath)
    actlog.log("workpath  =", options.workpath)
    actlog.log("logpath   =", options.logpath)

    flogfile = fsutils.appendPath(fpath, 'webmagr.log') 
    setattr(options, 'logfile', flogfile)
    
    actlog.log("action    =", options.action)
    if options.action == 'config_check' :
        action = {'action' : 'config_check',
                  'params':{}}
        thread_do_action(options, action)
        return

    if options.action == 'config_reload' :
        action = {'action' : 'config_reload',
                  'params':{}}
        thread_do_action(options, action)
        return

    if options.action == 'config_update' :
        keys = []
        if hasattr(options, 'keys') :
            keys =  options.keys.split(',')
        action = {'action' : 'config_update',
                  'params':{'keys' : keys}}
        thread_do_action(options, action)
        return

    if options.action == 'config_reset' :
        action = {'action' : 'config_update',
                  'params':{'reset' : 1}}
        thread_do_action(options, action)
        return

    if options.action == 'config_status' :
        action = {'action' : 'config_status',
                  'params':{}}
        thread_do_action(options, action)
        return
    
    if options.action == 'compile' :
        action = {'action' : 'compile_source',
                  'params':{}}
        thread_do_action(options, action)
        return

    if options.action == 'start' :
        action = {'action' : 'config_compile_start',
                  'params':{}}
        thread_do_action(options, action)
        return

    if options.action == 'reset' :
        if not hasattr(options, 'serverIds') :
            useage()
            actlog.log('You must input -sid XXX,XXX')
            return
        processids = options.serverIds.split(',')
        if not processids :
            useage()
            actlog.log('You must input -sid XXX,XXX')
            return
        action = {'action' : 'reset',
                  'params':{'processids' : processids}}
        thread_do_action(options, action)
        return
    
    if options.action == 'stop' :
        action = {'action' : 'stop_all_process',
                  'params':{}}
        thread_do_action(options, action)
        return
    
    if options.action == 'push_code' :
        action = {'action' : 'push_bin',
                  'params':{}}
        thread_do_action(options, action)
        return

    if options.action == 'push_web' :
        action = {'action' : 'push_web',
                  'params':{}}
        thread_do_action(options, action)
        return

    hotfixwait = 1
    if options.action == 'hotfix_nowait' :
        options.action = 'hotfix'
        hotfixwait = 0
    setattr(options, 'hotfixwait', hotfixwait)
        
    if options.action == 'hotfix' :
        if not hasattr(options, 'serverIds') :
            useage()
            actlog.log('You must input -sid XXX,XXX or -sid all')
            return
        if not hasattr(options, 'hotfixpy') :
            useage()
            actlog.log('You Must input -py xxxx.py')
            return
        hotfix.action(options)
        return

    if options.action == 'rm_logs' :
        action = {'action' : 'remove_all_logs',
                  'params':{}}
        thread_do_action(options, action)
        return

    actlog.log('unknow action of :', options.action)
    useage()