From bcfd769306f13296cacf02aa9c862789453d422c Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Mon, 25 May 2020 00:08:05 +0500 Subject: [PATCH] bug fix backupSchedule.py --- plogical/backupSchedule.py | 30 +++++++++++++++++++++++++++++- plogical/backupScheduleLocal.py | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/plogical/backupSchedule.py b/plogical/backupSchedule.py index a2ebcdf01..46f531eab 100755 --- a/plogical/backupSchedule.py +++ b/plogical/backupSchedule.py @@ -88,7 +88,35 @@ class backupSchedule: if (ifRunning.find('startBackup') > -1 or ifRunning.find('BackupRoot') > -1) and ifRunning.find('/%s/' % (backupDomain)): pass else: - return 0, 'Backup process killed without reporting any error.' + if os.path.exists(status): + + status = open(status, 'r').read() + time.sleep(2) + + if status.find("Completed") > -1: + + ### Removing Files + + command = 'sudo rm -f ' + status + ProcessUtilities.normalExecutioner(command) + + command = 'sudo rm -f ' + backupFileNamePath + ProcessUtilities.normalExecutioner(command) + + command = 'sudo rm -f ' + pid + ProcessUtilities.normalExecutioner(command) + + backupSchedule.remoteBackupLogging(backupLogPath, "Backup Completed for: " + virtualHost) + try: + os.remove(pathToFile) + except: + pass + return 1, tempStoragePath + else: + return 0, 'Backup process killed without reporting any error.' + else: + + return 0, 'Backup process killed without reporting any error.' ## file name read ends diff --git a/plogical/backupScheduleLocal.py b/plogical/backupScheduleLocal.py index 3a69f20fa..6065b9c92 100755 --- a/plogical/backupScheduleLocal.py +++ b/plogical/backupScheduleLocal.py @@ -61,6 +61,7 @@ class backupScheduleLocal: retValues = backupSchedule.createLocalBackup(virtualHost, backupLogPath) if retValues[0] == 0: + backupSchedule.remoteBackupLogging(backupLogPath, '[ERROR] Backup failed for %s, error: %s moving on..' % (virtualHost, retValues[1]), backupSchedule.ERROR) continue if os.path.exists(backupScheduleLocal.localBackupPath):