From 64ac1b2188da5e4e09b0a6c9635d152599b11ae3 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sun, 9 Jun 2024 14:13:38 +0800 Subject: [PATCH] =?UTF-8?q?backup=5Fftp=E6=8F=92=E4=BB=B6-=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=A4=87=E4=BB=BD=E4=BF=AE=E5=A4=8D2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/backup_ftp/index.py | 10 +++++++--- scripts/backup.py | 5 ++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/backup_ftp/index.py b/plugins/backup_ftp/index.py index 8d48abc24..34dd3f959 100755 --- a/plugins/backup_ftp/index.py +++ b/plugins/backup_ftp/index.py @@ -182,7 +182,7 @@ def findPathName(path, filename): t['filename'] = path + '/' + ff.name l.append(t) return l - + def backupAllFunc(stype): os.chdir(mw.getRunDir()) @@ -247,6 +247,10 @@ def backupAllFunc(stype): bk_name = stype find_path = mw.getBackupDir() + '/' + bk_name + '/' + bk_prefix + '_' + name + if stype == 'path': + _name = 'path_{}'.format(os.path.basename(name)) + find_path = mw.getBackupDir() + '/path/'+_name + find_new_file = "ls " + find_path + \ "_* | grep '.gz' | cut -d \ -f 1 | awk 'END {print}'" @@ -255,7 +259,7 @@ def backupAllFunc(stype): mw.echoInfo("not find upload file!") return '' - print("|-准备上传文件 {}".format(filename)) + mw.echoInfo("准备上传文件 {}".format(filename)) ftp = FtpPSClient() ftp.uploadFile(filename, stype) @@ -269,7 +273,7 @@ def backupAllFunc(stype): fn = os.path.basename(backup['filename']) object_name = ftp.buildDirName(stype, fn) ftp.deleteFile(object_name) - mw.echoInfo("---已清理远程过期备份文件:" + object_name) + mw.echoInfo("已清理远程过期备份文件:" + object_name) sep -= 1 if sep < 0: break diff --git a/scripts/backup.py b/scripts/backup.py index 799171370..5ecf5811e 100755 --- a/scripts/backup.py +++ b/scripts/backup.py @@ -55,8 +55,7 @@ class backupTools: if not os.path.exists(filename): log = "网站[" + name + "]备份失败!" print("★[" + endDate + "] " + log) - print( - "----------------------------------------------------------------------------") + print("----------------------------------------------------------------------------") return outTime = time.time() - startTime @@ -259,7 +258,7 @@ class backupTools: for backup in backups: abspath_bk = backup_path + "/" + backup mw.execShell("rm -f " + abspath_bk) - mw.echoInfo("|---已清理过期备份文件:" + abspath_bk) + mw.echoInfo("已清理过期备份文件:" + abspath_bk) num -= 1 if num < 1: break