From 727d84004f6f15d219e583c323da8f2b96ab4466 Mon Sep 17 00:00:00 2001 From: KiekerJan Date: Mon, 13 Jun 2022 20:25:48 +0200 Subject: [PATCH 1/2] add configurable backup dir to status checks --- management/status_checks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/management/status_checks.py b/management/status_checks.py index 2742dfbc..2f61f1d8 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -20,6 +20,7 @@ from ssl_certificates import get_ssl_certificates, get_domain_ssl_files, check_c from mailconfig import get_mail_domains, get_mail_aliases from utils import shell, sort_domains, load_env_vars_from_file, load_settings +from backup import get_backup_root def get_services(): return [ @@ -261,7 +262,7 @@ def check_free_disk_space(rounded_values, env, output): # Check that there's only one duplicity cache. If there's more than one, # it's probably no longer in use, and we can recommend clearing the cache # to save space. The cache directory may not exist yet, which is OK. - backup_cache_path = os.path.join(env['STORAGE_ROOT'], 'backup/cache') + backup_cache_path = os.path.join(get_backup_root(env), 'cache') try: backup_cache_count = len(os.listdir(backup_cache_path)) except: From 5787f0dfd5042d7becaaf2da01f74285e2215608 Mon Sep 17 00:00:00 2001 From: KiekerJan Date: Sun, 3 Jul 2022 18:29:08 +0200 Subject: [PATCH 2/2] fix access rights of after-backup script --- management/backup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/management/backup.py b/management/backup.py index 0f180664..5a394505 100755 --- a/management/backup.py +++ b/management/backup.py @@ -297,7 +297,7 @@ def perform_backup(full_backup): pre_script = os.path.join(backup_root, 'before-backup') if os.path.exists(pre_script): shell('check_call', - ['su', env['STORAGE_USER'], '-c', pre_script, config["target"]], + ['su', env['STORAGE_USER'], '--login', '-c', pre_script, config["target"]], env=env) # Run a backup of STORAGE_ROOT (but excluding the backups themselves!). @@ -369,8 +369,8 @@ def perform_backup(full_backup): post_script = os.path.join(backup_root, 'after-backup') if os.path.exists(post_script): shell('check_call', - ['su', env['STORAGE_USER'], '-c', post_script, config["target"]], - env=env) + ['su', env['STORAGE_USER'], '--login', '-c', post_script, config["target"]], + env=env, trap=True) def run_duplicity_verification(): env = load_environment()