Renamed variables

This commit is contained in:
Kevin Veen-Birkenbach 2022-01-23 16:03:27 +01:00
parent 454826b7e9
commit 7206be8294

View File

@ -46,21 +46,21 @@ for volume_name in volume_names:
source_path_command_result_filtered=list(filter(None, bash(source_path_command))) source_path_command_result_filtered=list(filter(None, bash(source_path_command)))
for source_path in source_path_command_result_filtered: for source_path in source_path_command_result_filtered:
destination_path=backup_repository_folder+"latest/"+ volume_name destination_path=backup_repository_folder+"latest/"+ volume_name
raw_destination_path=destination_path + "/raw" sql_destination_path=destination_path + "/files"
prepared_destination_path=destination_path + "/prepared" sql_destination_path=destination_path + "/sql"
log_path=backup_repository_folder + "log.txt" log_path=backup_repository_folder + "log.txt"
backup_dir_path=backup_repository_folder + "diffs/"+ backup_time + "/" + volume_name backup_dir_path=backup_repository_folder + "diffs/"+ backup_time + "/" + volume_name
raw_backup_dir_path=backup_dir_path + "/raw" files_backup_dir_path=backup_dir_path + "/files"
prepared_backup_dir_path=backup_dir_path + "/prepared" sql_backup_dir_path=backup_dir_path + "/sql"
if os.path.exists(destination_path): if os.path.exists(destination_path):
print("backup volume: " + volume_name); print("backup volume: " + volume_name);
else: else:
print("first backup volume: " + volume_name); print("first backup volume: " + volume_name);
pathlib.Path(raw_destination_path).mkdir(parents=True, exist_ok=True) pathlib.Path(sql_destination_path).mkdir(parents=True, exist_ok=True)
pathlib.Path(raw_backup_dir_path).mkdir(parents=True, exist_ok=True) pathlib.Path(files_backup_dir_path).mkdir(parents=True, exist_ok=True)
pathlib.Path(prepared_destination_path).mkdir(parents=True, exist_ok=True) pathlib.Path(sql_destination_path).mkdir(parents=True, exist_ok=True)
pathlib.Path(prepared_backup_dir_path).mkdir(parents=True, exist_ok=True) pathlib.Path(sql_backup_dir_path).mkdir(parents=True, exist_ok=True)
print_bash("docker run --rm --volumes-from " + container + " -v "+backups_folder+":"+ backups_folder +" \"kevinveenbirkenbach/alpine-rsync\" sh -c \"rsync -abP --delete --delete-excluded --log-file=" + log_path +" --backup-dir=" + raw_backup_dir_path +" '"+ source_path +"/' " + raw_destination_path +"\"") print_bash("docker run --rm --volumes-from " + container + " -v "+backups_folder+":"+ backups_folder +" \"kevinveenbirkenbach/alpine-rsync\" sh -c \"rsync -abP --delete --delete-excluded --log-file=" + log_path +" --backup-dir=" + files_backup_dir_path +" '"+ source_path +"/' " + sql_destination_path +"\"")
print("start containers:") print("start containers:")
print_bash("docker start " + list_to_string(containers)) print_bash("docker start " + list_to_string(containers))
print("end backup routine for volume:" + volume_name) print("end backup routine for volume:" + volume_name)