From 58e300e113f2a65f937d7a23103975c9e98dc5b9 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Mon, 11 Aug 2014 07:14:47 -0400 Subject: [PATCH] backup must be full on the first run because incremental backup will fail, fixes #134 --- management/backup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/management/backup.py b/management/backup.py index 06061ec2..ae6cb480 100755 --- a/management/backup.py +++ b/management/backup.py @@ -16,7 +16,7 @@ from utils import exclusive_process, load_environment, shell # settings full_backup = "--full" in sys.argv -keep_backups_for = "31D" # destroy backups older than 31 days +keep_backups_for = "31D" # destroy backups older than 31 days except the most recent full backup env = load_environment() @@ -27,6 +27,11 @@ backup_dir = os.path.join(env["STORAGE_ROOT"], 'backup') backup_duplicity_dir = os.path.join(backup_dir, 'duplicity') os.makedirs(backup_dir, exist_ok=True) +# On the first run, always do a full backup. Incremental +# will fail. +if len(os.listdir(backup_duplicity_dir)) == 0: + full_backup = True + # Stop services. shell('check_call', ["/usr/sbin/service", "dovecot", "stop"]) shell('check_call', ["/usr/sbin/service", "postfix", "stop"])