From 4510b6974ece0495a2942965722e0e85c9310bb1 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 7 Jun 2024 22:37:07 +0500 Subject: [PATCH] bug fix: with rention of backups --- plogical/IncScheduler.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plogical/IncScheduler.py b/plogical/IncScheduler.py index c053e7e48..af94f3844 100644 --- a/plogical/IncScheduler.py +++ b/plogical/IncScheduler.py @@ -657,11 +657,14 @@ def startNormalBackups(type): continue try: - - command = f'find cpbackups -type f -mtime +{destinationConfig["retention"]} -exec rm -f {{}} \\;' - ssh.exec_command(command) + command = f'find cpbackups -type f -mtime +{jobConfig["retention"]} -exec rm -f {{}} \\;' logging.writeToFile(command) - except: + ssh.exec_command(command) + command = 'find cpbackups -type d -empty -delete' + ssh.exec_command(command) + + except BaseException as msg: + logging.writeToFile(f'Failed to delete old backups, Error {str(msg)}') pass # Execute the command to create the remote directory