From d6b2b3c98589555ea33d11bc7aa7e8beb4e2d276 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 17 Mar 2022 21:10:43 +0100 Subject: [PATCH] Reduced container down time --- docker-volume-backup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-volume-backup.py b/docker-volume-backup.py index fd3f4c2..c372aa6 100644 --- a/docker-volume-backup.py +++ b/docker-volume-backup.py @@ -65,9 +65,13 @@ for volume_name in volume_names: files_backup_dir_path=backup_dir_path + "/files" pathlib.Path(files_backup_dir_path).mkdir(parents=True, exist_ok=True) pathlib.Path(files_destination_path).mkdir(parents=True, exist_ok=True) + print("Backup data during container is running...") + rsync_command="rsync -abP --delete --delete-excluded --log-file=" + log_path +" --backup-dir=" + files_backup_dir_path +" '"+ source_path +"/' " + files_destination_path + print_bash(rsync_command) print("stop containers..."); + print("Backup data after container is stopped...") print_bash("docker stop " + list_to_string(containers)) - print_bash("rsync -abP --delete --delete-excluded --log-file=" + log_path +" --backup-dir=" + files_backup_dir_path +" '"+ source_path +"/' " + files_destination_path) + print_bash(rsync_command) print("start containers...") print_bash("docker start " + list_to_string(containers)) print("end backup routine for volume:" + volume_name)