python/samples/ops.py
def backup(ServiceName):
    '''
        Desc: Backup GameServer
 
        CLI Example:
                opsmod.py ServiceName backup
    '''    
    logging.info('{0} backup'.format(ServiceName))  
    bakname = ServiceName + '_' +  datetime.datetime.now().strftime('%Y%m%d%H%M%S') + '.zip'
    zipname = os.path.join(bdes_path, bakname)
    f = zipfile.ZipFile(zipname, 'w', zipfile.ZIP_DEFLATED)
    for bsrc_path in bsrc_path_lt[ServiceName]:
        bac_path = os.path.dirname(bsrc_path)
        ls_path = bac_path + '/'
        zg_path = bsrc_path.split(ls_path)[1]
        os.chdir(bac_path)
        for dirpath, dirnames, filenames in os.walk(zg_path):
            for filename in filenames:
                f.write(os.path.join(dirpath, filename)) 
    f.close()
    return G('Backup is successful !')

        Desc: Backup GameServer
 
        CLI Example:
                opsmod.py ServiceName backup
    
Backup GameServer
CLI Example:
opsmod.py ServiceName backup
Backup GameServer CLI Example : opsmod . py ServiceName backup
def backup(ServiceName):
    logging.info('{0} backup'.format(ServiceName))  
    bakname = ServiceName + '_' +  datetime.datetime.now().strftime('%Y%m%d%H%M%S') + '.zip'
    zipname = os.path.join(bdes_path, bakname)
    f = zipfile.ZipFile(zipname, 'w', zipfile.ZIP_DEFLATED)
    for bsrc_path in bsrc_path_lt[ServiceName]:
        bac_path = os.path.dirname(bsrc_path)
        ls_path = bac_path + '/'
        zg_path = bsrc_path.split(ls_path)[1]
        os.chdir(bac_path)
        for dirpath, dirnames, filenames in os.walk(zg_path):
            for filename in filenames:
                f.write(os.path.join(dirpath, filename)) 
    f.close()
    return G('Backup is successful !')
def backup ( ServiceName ) : logging . info ( '{0} backup' . format ( ServiceName ) ) bakname = ServiceName + '_' + datetime . datetime . now ( ) . strftime ( '%Y%m%d%H%M%S' ) + '.zip' zipname = os . path . join ( bdes_path , bakname ) f = zipfile . ZipFile ( zipname , 'w' , zipfile . ZIP_DEFLATED ) for bsrc_path in bsrc_path_lt [ ServiceName ] : bac_path = os . path . dirname ( bsrc_path ) ls_path = bac_path + '/' zg_path = bsrc_path . split ( ls_path ) [ 1 ] os . chdir ( bac_path ) for dirpath , dirnames , filenames in os . walk ( zg_path ) : for filename in filenames : f . write ( os . path . join ( dirpath , filename ) ) f . close ( ) return G ( 'Backup is successful !' )
Desc: Backup GameServer
CLI Example:
opsmod.py ServiceName backup
Desc : Backup GameServer CLI Example : opsmod . py ServiceName backup
'''
        Desc: Backup GameServer
 
        CLI Example:
                opsmod.py ServiceName backup
    '''
ServiceName