From 0dde6b8df996e21e2d29c3e2476d72b57e31650b Mon Sep 17 00:00:00 2001 From: Fuxino Date: Sun, 30 Apr 2023 11:32:35 +0200 Subject: [PATCH] Fix last_backup broken link detection --- simple_backup.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/simple_backup.py b/simple_backup.py index 867b0f2..9be9b80 100755 --- a/simple_backup.py +++ b/simple_backup.py @@ -148,7 +148,12 @@ class Backup: try: self._last_backup = os.readlink(f'{self.output}/simple_backup/last_backup') except Exception: - logger.error('Previous backup could not be read') + logger.warning('Previous backup could not be read') + else: + logger.info('No previous backups available') + + if not os.path.isdir(self._last_backup): + logger.warning('Previous backup could not be read') # Function to read configuration file @timing(logger) @@ -282,6 +287,8 @@ def simple_backup(): else: backup_options = '-arvh -H -X' + output = os.path.abspath(output) + backup = Backup(inputs, output, exclude, keep, backup_options) if backup.check_params():