ftp备份数据库优化

pull/228/head
midoks 3 years ago
parent 2f7ec60e89
commit f5ec3bba3d
  1. 4
      plugins/backup_ftp/class/ftp_client.py
  2. 6
      plugins/backup_ftp/index.py

@ -187,7 +187,7 @@ class FtpPSClient:
} }
mw.writeFile(pg_file, json.dumps(progress_info)) mw.writeFile(pg_file, json.dumps(progress_info))
else: else:
progress_info = json.loads(public.readFile(pg_file)) progress_info = json.loads(mw.readFile(pg_file))
if total_bytes == progress_info.get("total_bytes"): if total_bytes == progress_info.get("total_bytes"):
# 取远程文件大小 # 取远程文件大小
_max_loop = 10 _max_loop = 10
@ -352,7 +352,7 @@ class FtpPSClient:
ftp.rmd(dir_name) ftp.rmd(dir_name)
return True return True
except ftplib.error_perm as e: except ftplib.error_perm as e:
print(str(e) + ":" + dir_name) print("deleteDir:" + str(e) + ":" + dir_name)
except Exception as e: except Exception as e:
print(e) print(e)
return False return False

@ -192,10 +192,12 @@ def backupAllFunc(stype):
prefix_dict[stype] + '_' + name prefix_dict[stype] + '_' + name
find_new_file = "ls " + find_path + \ find_new_file = "ls " + find_path + \
"_* | grep tar.gz | cut -d \ -f 1 | awk 'END {print}'" "_* | grep '.gz' | cut -d \ -f 1 | awk 'END {print}'"
filename = mw.execShell(find_new_file)[0].strip() filename = mw.execShell(find_new_file)[0].strip()
# print("filename:", filename) if filename == "":
print("not find upload file!")
return False
ftp = FtpPSClient() ftp = FtpPSClient()
ftp.uploadFile(filename, stype) ftp.uploadFile(filename, stype)

Loading…
Cancel
Save