mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-20 08:25:50 +08:00
update
This commit is contained in:
@@ -1260,6 +1260,11 @@ def importDbExternal():
|
||||
|
||||
# print(file,name)
|
||||
# print(import_dir,name)
|
||||
auth = getConfAuth()
|
||||
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
|
||||
uoption = ''
|
||||
if auth != 'disabled':
|
||||
uoption =' -u root -p '+mg_root
|
||||
|
||||
file_dir = import_dir+name
|
||||
if not os.path.exists(file_dir):
|
||||
@@ -1274,7 +1279,7 @@ def importDbExternal():
|
||||
bson_list = getListBson(name)
|
||||
# print(bson_list)
|
||||
for x in bson_list:
|
||||
cmd = getServerDir() + "/bin/mongorestore --port "+str(port)+" --dir "+file_dir+'/'+x
|
||||
cmd = getServerDir() + "/bin/mongorestore "+uoption+" --port "+str(port)+" --dir "+file_dir+'/'+x
|
||||
# print(cmd)
|
||||
rdata = mw.execShell(cmd)
|
||||
# print(data)
|
||||
@@ -1312,7 +1317,13 @@ def importDbBackup():
|
||||
# print(cmd)
|
||||
mw.execShell(cmd)
|
||||
|
||||
cmd = getServerDir() + "/bin/mongorestore --port "+str(port)+" --dir "+file_dir
|
||||
auth = getConfAuth()
|
||||
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
|
||||
uoption = ''
|
||||
if auth != 'disabled':
|
||||
uoption =' -u root -p '+mg_root
|
||||
|
||||
cmd = getServerDir() + "/bin/mongorestore "+uoption+" --port "+str(port)+" --dir "+file_dir
|
||||
# print(cmd)
|
||||
mw.execShell(cmd)
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ def getServerDir():
|
||||
def getConf():
|
||||
path = getServerDir() + "/mongodb.conf"
|
||||
return path
|
||||
|
||||
|
||||
def getConfigData():
|
||||
cfg = getConf()
|
||||
config_data = mw.readFile(cfg)
|
||||
@@ -137,8 +137,14 @@ class backupTools:
|
||||
backup_name = "mongodb_" + name + "_" + time_now + ".tar.gz"
|
||||
filename = backup_path + "/"+backup_name
|
||||
|
||||
port = getConfPort()
|
||||
auth = getConfAuth()
|
||||
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
|
||||
uoption = ''
|
||||
if auth != 'disabled':
|
||||
uoption =' -u root -p '+mg_root
|
||||
|
||||
cmd = db_path + "/bin/mongodump --port 27017 -d test -o "+backup_path
|
||||
cmd = db_path + "/bin/mongodump "+uoption+" --port "+str(port)+" -d test -o "+backup_path
|
||||
mw.execShell(cmd)
|
||||
cmd_gz = "cd "+backup_path+"/"+name+" && tar -zcvf "+filename + " ./"
|
||||
mw.execShell(cmd_gz)
|
||||
|
||||
Reference in New Issue
Block a user