feat: Updates backup script to only copy directories.

This commit is contained in:
2025-04-21 09:50:03 -04:00
parent 189f2c36de
commit 723cd1ec1c

View File

@@ -3,7 +3,9 @@
today=$(date +'%F')
stackdir="/etc/komodo/stacks"
backupdir="/backups"
services=($(find "$stackdir" -maxdepth 1 -mindepth 1 -type d))
services=()
readarray -d '' services < <(find "$stackdir" -maxdepth 1 -mindepth 1 -type d)
# Add volumes here to backup.
volumes=(
@@ -39,7 +41,14 @@ function copyVolumes() {
local dir="$1/volumes"
mkdir "$dir"
for volume in "${volumes[@]}"; do
cp -r --parents "$volume" "$dir"
# copy only directories.
#
find "$volume" -maxdepth 1 -mindepth 1 -type d -print0 |
xargs -0 -I {} cp -r --parents "$volume" "{}"
# for dir in $(find "$volume" -maxdepth 1 -mindepth 1 -type d); do
# cp -r --parents "$volume" "$dir"
# done
done
}