def update_backend(gameServer, version, mainland=True):
backup_dir = '/app/opbak/{}/{}'.format(TIME, gameServer)
run(''' [ -d {0} ] || mkdir -p {0} '''.format(backup_dir))
with cd('/app/{}/backend/apps'.format(gameServer)):
for conf_file in ['app.properties', 'plugins.xml']:
#check if the config exists
with quiet():
conf_exists = run('test -f {}'.format(conf_file)).succeeded
if conf_exists:
run('cp {} {}/'.format(conf_file, backup_dir))
if mainland:
cmd = ''' sed -i '/http:\/\/.*\/%s/s/%stest_[0-9]\{1,3\}-[0-9]\{1,3\}-[0-9]\{1,3\}/%s/g' %s ''' % (GAME, GAME, version, conf_file)
else:
cmd = ''' sed -i '/http:\/\/.*\/%s/s/%stest_[a-z]\{2,5\}_[0-9]\{1,3\}-[0-9]\{1,3\}-[0-9]\{1,3\}/%s/g' %s ''' % (GAME, GAME, version, conf_file)
run(cmd)
评论列表
文章目录