Commit 58e300e1 authored by Joshua Tauberer's avatar Joshua Tauberer

backup must be full on the first run because incremental backup will fail, fixes #134

parent 140c508f
...@@ -16,7 +16,7 @@ from utils import exclusive_process, load_environment, shell ...@@ -16,7 +16,7 @@ from utils import exclusive_process, load_environment, shell
# settings # settings
full_backup = "--full" in sys.argv 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() env = load_environment()
...@@ -27,6 +27,11 @@ backup_dir = os.path.join(env["STORAGE_ROOT"], 'backup') ...@@ -27,6 +27,11 @@ backup_dir = os.path.join(env["STORAGE_ROOT"], 'backup')
backup_duplicity_dir = os.path.join(backup_dir, 'duplicity') backup_duplicity_dir = os.path.join(backup_dir, 'duplicity')
os.makedirs(backup_dir, exist_ok=True) 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. # Stop services.
shell('check_call', ["/usr/sbin/service", "dovecot", "stop"]) shell('check_call', ["/usr/sbin/service", "dovecot", "stop"])
shell('check_call', ["/usr/sbin/service", "postfix", "stop"]) shell('check_call', ["/usr/sbin/service", "postfix", "stop"])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment