From a778ec7fcf6f1d378dc7f276492620c8453a608c Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 24 Dec 2020 16:59:42 +0100 Subject: [PATCH] Changed optional parameter to define backup user --- README.md | 4 ++-- docker-volume-backup.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7754947..1f2d0d5 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,10 @@ Execute: ./docker-volume-backup.sh ``` -Optional a directory for the backup folder can be defined: +Optional a user for the backup can be defined: ```bash -./docker-volume-backup.sh /tmp +./docker-volume-backup.sh administrator ``` ## Test diff --git a/docker-volume-backup.sh b/docker-volume-backup.sh index 4dc6e37..5b34f32 100644 --- a/docker-volume-backup.sh +++ b/docker-volume-backup.sh @@ -1,11 +1,11 @@ #!/bin/bash # @todo rethink optional parameter -# @param $1 [optional] : The path for the backups folder. DEFAULT $HOME/Backups/ +# @param $1 [optional] : The user for the backups # @see https://www.freedesktop.org/software/systemd/man/machine-id.html backup_time="$(date '+%Y%m%d%H%M%S')" -docker_backups_mount="$(test -z "$1" && echo "/Backups/" || echo "/$(basename "$1")/")" -native_backups_mount_prefix="$(test -z "$1" && echo "$HOME" || echo "/$(dirname "$1")/")" +docker_backups_mount="/Backups/" +native_backups_mount_prefix="$(test -z "$1" && echo "$HOME" || echo "/home/$1")" native_backups_mount="$native_backups_mount_prefix$docker_backups_mount" for docker_container_name in $(docker ps --format '{{.Names}}'); do