Implemented stamp function

This commit is contained in:
Kevin Veen-Birkenbach 2024-01-29 20:04:21 +01:00
parent e9588b0e31
commit 69a1ea30aa
2 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -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__":