From 69a1ea30aa3c5b55d4833b27904cde0487c3ee6d Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Mon, 29 Jan 2024 20:04:21 +0100 Subject: [PATCH] Implemented stamp function --- README.md | 2 +- backup-docker-to-local.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 13a53fe..d46f520 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ This project is licensed under the GNU Affero General Public License v3.0. The f - https://blog.ssdnodes.com/blog/docker-backup-volumes/ - https://www.baculasystems.com/blog/docker-backup-containers/ - https://gist.github.com/spalladino/6d981f7b33f6e0afe6bb -- https://stackoverflow.com/questions/26331651/how-can-i-backup-a-docker-container-with-its-data-volumes +- https://stackoverflow.com/questions/26331651/how-can-i-backup-a-docker/container/with-its-data-volumes - https://netfuture.ch/2013/08/simple-versioned-timemachine-like-backup-using-rsync/ - https://zwischenzugs.com/2016/08/29/bash-to-python-converter/ - https://en.wikipedia.org/wiki/Incremental_backup#Incremental diff --git a/backup-docker-to-local.py b/backup-docker-to-local.py index a735936..01325be 100644 --- a/backup-docker-to-local.py +++ b/backup-docker-to-local.py @@ -89,6 +89,16 @@ def get_instance(container): print(f"Extracted instance name: {instance_name}") return instance_name +def stamp_directory(): + """Stamp a directory using directory-validator.""" + stamp_command = f"python ../directory-validator/directory-validator.py --stamp {VERSION_DIR}" + try: + execute_shell_command(stamp_command) + print(f"Successfully stamped directory: {VERSION_DIR}") + except BackupException as e: + print(f"Error stamping directory {VERSION_DIR}: {e}") + exit(1) + def backup_database(container, volume_dir, db_type): """Backup database (MariaDB or PostgreSQL) if applicable.""" print(f"Starting database backup for {container} using {db_type}...") @@ -288,7 +298,7 @@ def main(): backup_everything(volume_name, containers, args.shutdown) else: default_backup_routine_for_volume(volume_name, containers, args.shutdown) - + stamp_directory() print('Finished volume backups.') if __name__ == "__main__":