mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup.git
synced 2024-11-22 00:11:03 +01:00
Moved variables for better readability
This commit is contained in:
parent
660c847383
commit
862797e51a
@ -5,6 +5,9 @@
|
||||
#
|
||||
backup_time="$(date '+%Y%m%d%H%M%S')";
|
||||
backups_folder="/Backups/";
|
||||
repository_name="$(cd "$(dirname "$(readlink -f "${0}")")" && basename `git rev-parse --show-toplevel`)";
|
||||
machine_id="$(sha256sum /etc/machine-id | head -c 64)";
|
||||
backup_repository_folder="$backups_folder$machine_id/$repository_name/";
|
||||
for volume_name in $(docker volume ls --format '{{.Name}}');
|
||||
do
|
||||
for container_name in $(docker ps -a --filter volume=$volume_name --format '{{.Names}}');
|
||||
@ -12,9 +15,6 @@ do
|
||||
echo "stop container: $container_name" && docker stop "$container_name"
|
||||
for source_path in $(docker inspect --format '{{ range .Mounts }}{{ if eq .Type "volume" }}{{ println .Destination }}{{ end }}{{ end }}' "$container_name");
|
||||
do
|
||||
repository_name="$(cd "$(dirname "$(readlink -f "${0}")")" && basename `git rev-parse --show-toplevel`)";
|
||||
machine_id="$(sha256sum /etc/machine-id | head -c 64)";
|
||||
backup_repository_folder="$backups_folder$machine_id/$repository_name/";
|
||||
destination_path="$backup_repository_folder""latest/$container_name$source_path";
|
||||
log_path="$backup_repository_folder""log.txt";
|
||||
backup_dir_path="$backup_repository_folder""diffs/$backup_time/$container_name$source_path";
|
||||
|
Loading…
Reference in New Issue
Block a user