From eaaea859d2eb2d2b7a69c2fbcf0aff8d4be251cf Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Thu, 27 Aug 2020 13:32:54 +0500 Subject: [PATCH] remove backup dir if backup is failed --- plogical/backupSchedule.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plogical/backupSchedule.py b/plogical/backupSchedule.py index 8f8bf9cc3..ef6d4f554 100755 --- a/plogical/backupSchedule.py +++ b/plogical/backupSchedule.py @@ -141,6 +141,9 @@ class backupSchedule: os.remove(pathToFile) except: pass + + command = 'rm -rf %s' % (tempStoragePath) + ProcessUtilities.normalExecutioner(command) return 0, tempStoragePath elif os.path.exists(schedulerPath): @@ -148,6 +151,8 @@ class backupSchedule: open(schedulerPath, 'r').read()), backupSchedule.ERROR) os.remove(schedulerPath) + command = 'rm -rf %s' % (tempStoragePath) + ProcessUtilities.normalExecutioner(command) return 0, 'Backup process killed.' else: if os.path.exists(status): @@ -177,6 +182,8 @@ class backupSchedule: backupSchedule.remoteBackupLogging(backupLogPath, 'Backup process killed. Error: %s' % (open(schedulerPath, 'r').read()), backupSchedule.ERROR) os.remove(schedulerPath) + command = 'rm -rf %s' % (tempStoragePath) + ProcessUtilities.normalExecutioner(command) return 0, 'Backup process killed.' else: if killCounter == 1: @@ -186,6 +193,8 @@ class backupSchedule: open(schedulerPath, 'r').read()), backupSchedule.ERROR) os.remove(schedulerPath) + command = 'rm -rf %s' % (tempStoragePath) + ProcessUtilities.normalExecutioner(command) return 0, 'Backup process killed.' else: time.sleep(10)