mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup.git
synced 2024-11-22 08:21:04 +01:00
Changed optional parameter to define backup user
This commit is contained in:
parent
0434782049
commit
a778ec7fcf
@ -9,10 +9,10 @@ Execute:
|
|||||||
./docker-volume-backup.sh
|
./docker-volume-backup.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
Optional a directory for the backup folder can be defined:
|
Optional a user for the backup can be defined:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./docker-volume-backup.sh /tmp
|
./docker-volume-backup.sh administrator
|
||||||
```
|
```
|
||||||
|
|
||||||
## Test
|
## Test
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# @todo rethink optional parameter
|
# @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
|
# @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="/Backups/"
|
||||||
native_backups_mount_prefix="$(test -z "$1" && echo "$HOME" || echo "/$(dirname "$1")/")"
|
native_backups_mount_prefix="$(test -z "$1" && echo "$HOME" || echo "/home/$1")"
|
||||||
native_backups_mount="$native_backups_mount_prefix$docker_backups_mount"
|
native_backups_mount="$native_backups_mount_prefix$docker_backups_mount"
|
||||||
for docker_container_name in $(docker ps --format '{{.Names}}');
|
for docker_container_name in $(docker ps --format '{{.Names}}');
|
||||||
do
|
do
|
||||||
|
Loading…
Reference in New Issue
Block a user