mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup.git
synced 2024-11-22 08:21:04 +01:00
hashed machine-id for security reasons
This commit is contained in:
parent
f325a79047
commit
a3d040fbe9
@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# @todo rethink optional parameter
|
||||||
# @param $1 [optional] : The path for the backups folder. DEFAULT $HOME/Backups/
|
# @param $1 [optional] : The path for the backups folder. DEFAULT $HOME/Backups/
|
||||||
|
# @see https://www.freedesktop.org/software/systemd/man/machine-id.html
|
||||||
|
|
||||||
backup_time="$(date '+%Y%m%d%H%M%S')"
|
backup_time="$(date '+%Y%m%d%H%M%S')"
|
||||||
docker_backups_mount="$(test -z "$1" && echo "/Backups/" || echo "/$(basename "$1")/")"
|
docker_backups_mount="$(test -z "$1" && echo "/Backups/" || echo "/$(basename "$1")/")"
|
||||||
@ -10,7 +12,7 @@ do
|
|||||||
echo "stop container: $docker_container_name" && docker stop "$docker_container_name"
|
echo "stop container: $docker_container_name" && docker stop "$docker_container_name"
|
||||||
for source_path in $(docker inspect --format '{{ range .Mounts }}{{ if eq .Type "volume" }}{{ println .Destination }}{{ end }}{{ end }}' "$docker_container_name");
|
for source_path in $(docker inspect --format '{{ range .Mounts }}{{ if eq .Type "volume" }}{{ println .Destination }}{{ end }}{{ end }}' "$docker_container_name");
|
||||||
do
|
do
|
||||||
application_path="$docker_backups_mount$(cat /etc/machine-id)/docker/$docker_container_name/";
|
application_path="$docker_backups_mount$(sha256sum /etc/machine-id | head -c 64)/docker/$docker_container_name/";
|
||||||
destination_path="$application_path""latest""$source_path";
|
destination_path="$application_path""latest""$source_path";
|
||||||
log_path="$application_path""log.txt";
|
log_path="$application_path""log.txt";
|
||||||
backup_dir_path="$application_path""diffs/$backup_time$source_path";
|
backup_dir_path="$application_path""diffs/$backup_time$source_path";
|
||||||
|
Loading…
Reference in New Issue
Block a user