move rm up, to keep the latest backup in the volume
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
5a20ef4349
commit
d6faffcbbd
|
@ -72,6 +72,8 @@ else
|
|||
fi
|
||||
|
||||
if [[ \ $*\ != *\ --skip-backup\ * ]]; then
|
||||
rm -rf "${backup_path}"
|
||||
|
||||
for service in "${services[@]}"; do
|
||||
echo "service: $service"
|
||||
details=$(docker service inspect "$service" --format "{{ json .Spec.Labels }}")
|
||||
|
@ -100,7 +102,7 @@ if [[ \ $*\ != *\ --skip-backup\ * ]]; then
|
|||
# creates the parent folder, so `docker cp` has reliable behaviour no matter if $p ends with `/` or `/.`
|
||||
dir=$backup_path/$service/$(dirname "$p")
|
||||
test -d "$dir" || mkdir -p "$dir"
|
||||
docker cp "$container:$p" "$dir/$(basename "$p")"
|
||||
docker cp -a "$container:$p" "$dir/$(basename "$p")"
|
||||
done
|
||||
|
||||
if [ "$post" != "null" ]; then
|
||||
|
@ -122,4 +124,3 @@ if [[ \ $*\ != *\ --skip-upload\ * ]]; then
|
|||
_restic backup --host "$server_name" --tag coop-cloud "$backup_path"
|
||||
fi
|
||||
|
||||
rm -rf "${backup_path}"
|
Loading…
Reference in New Issue