Update index.py

pull/561/head
Mr Chen 1 year ago
parent fdac352244
commit 71b64b19a1
  1. 20
      plugins/mongodb/index.py

@ -1167,6 +1167,8 @@ def importDbBackup():
file = args['file'] file = args['file']
name = args['name'] name = args['name']
port = getConfPort()
file_tgz = mw.getRootDir() + '/backup/database/' + file file_tgz = mw.getRootDir() + '/backup/database/' + file
file_dir = mw.getRootDir() + '/backup/database/' + file.replace('.tar.gz','') file_dir = mw.getRootDir() + '/backup/database/' + file.replace('.tar.gz','')
@ -1179,20 +1181,14 @@ def importDbBackup():
# print(cmd) # print(cmd)
mw.execShell(cmd) mw.execShell(cmd)
cmd = getServerDir() + "/bin/mongorestore --port "+str(port)+" --dir "+file_dir
# print(cmd)
mw.execShell(cmd)
cmd = getServerDir() + "/bin/mongorestore --port 27017 --oplogReplay --dir "+file_dir
print(cmd)
# mw.execShell(cmd)
# pwd = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
# print(mysql_cmd)
# os.system(mysql_cmd)
# rdata = mw.execShell(mysql_cmd) # 删除文件
# if rdata[1].lower().find('error') > -1: del_cmd = "rm -rf "+file_dir
# return mw.returnJson(False, rdata[1]) mw.execShell(del_cmd)
return mw.returnJson(True, 'ok') return mw.returnJson(True, 'ok')

Loading…
Cancel
Save