Changed optional parameter to define backup user

This commit is contained in:
Kevin Veen-Birkenbach 2020-12-24 16:59:42 +01:00
parent 0434782049
commit a778ec7fcf
2 changed files with 5 additions and 5 deletions

View File

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

View File

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