Defined optional backup path

This commit is contained in:
Kevin Veen-Birkenbach 2020-10-12 14:59:40 +02:00
parent 2ccca4bd95
commit 4e98fddcdb
2 changed files with 8 additions and 2 deletions

View File

@ -9,6 +9,12 @@ Execute:
./docker-volume-backup.sh
```
Optional a directory for the backup folder can be defined:
```bash
./docker-volume-backup.sh /tmp
```
## Test
Delete the volume.

View File

@ -1,8 +1,8 @@
#!/bin/bash
# @param $1 [optional] : The path in which the backups folder will be created.
backup_time="$(date '+%Y%m%d%H%M%S')"
docker_backups_mount="/Backups/"
native_backups_mount_prefix="$HOME"
native_backups_mount_prefix="$(test -z "$1" && echo "$HOME" || echo "$1")"
native_backups_mount="$native_backups_mount_prefix$docker_backups_mount"
for docker_container_name in $(docker ps --format '{{.Names}}');
do