mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
backup_ftp插件-目录备份修复2
This commit is contained in:
@@ -247,6 +247,10 @@ def backupAllFunc(stype):
|
|||||||
bk_name = stype
|
bk_name = stype
|
||||||
|
|
||||||
find_path = mw.getBackupDir() + '/' + bk_name + '/' + bk_prefix + '_' + name
|
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 + \
|
find_new_file = "ls " + find_path + \
|
||||||
"_* | grep '.gz' | cut -d \ -f 1 | awk 'END {print}'"
|
"_* | grep '.gz' | cut -d \ -f 1 | awk 'END {print}'"
|
||||||
|
|
||||||
@@ -255,7 +259,7 @@ def backupAllFunc(stype):
|
|||||||
mw.echoInfo("not find upload file!")
|
mw.echoInfo("not find upload file!")
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
print("|-准备上传文件 {}".format(filename))
|
mw.echoInfo("准备上传文件 {}".format(filename))
|
||||||
ftp = FtpPSClient()
|
ftp = FtpPSClient()
|
||||||
ftp.uploadFile(filename, stype)
|
ftp.uploadFile(filename, stype)
|
||||||
|
|
||||||
@@ -269,7 +273,7 @@ def backupAllFunc(stype):
|
|||||||
fn = os.path.basename(backup['filename'])
|
fn = os.path.basename(backup['filename'])
|
||||||
object_name = ftp.buildDirName(stype, fn)
|
object_name = ftp.buildDirName(stype, fn)
|
||||||
ftp.deleteFile(object_name)
|
ftp.deleteFile(object_name)
|
||||||
mw.echoInfo("---已清理远程过期备份文件:" + object_name)
|
mw.echoInfo("已清理远程过期备份文件:" + object_name)
|
||||||
sep -= 1
|
sep -= 1
|
||||||
if sep < 0:
|
if sep < 0:
|
||||||
break
|
break
|
||||||
|
|||||||
+2
-3
@@ -55,8 +55,7 @@ class backupTools:
|
|||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
log = "网站[" + name + "]备份失败!"
|
log = "网站[" + name + "]备份失败!"
|
||||||
print("★[" + endDate + "] " + log)
|
print("★[" + endDate + "] " + log)
|
||||||
print(
|
print("----------------------------------------------------------------------------")
|
||||||
"----------------------------------------------------------------------------")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
outTime = time.time() - startTime
|
outTime = time.time() - startTime
|
||||||
@@ -259,7 +258,7 @@ class backupTools:
|
|||||||
for backup in backups:
|
for backup in backups:
|
||||||
abspath_bk = backup_path + "/" + backup
|
abspath_bk = backup_path + "/" + backup
|
||||||
mw.execShell("rm -f " + abspath_bk)
|
mw.execShell("rm -f " + abspath_bk)
|
||||||
mw.echoInfo("|---已清理过期备份文件:" + abspath_bk)
|
mw.echoInfo("已清理过期备份文件:" + abspath_bk)
|
||||||
num -= 1
|
num -= 1
|
||||||
if num < 1:
|
if num < 1:
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user