Files
borgmatic-config/pre-backup-all-docker-compose-down.sh
Chris King d41498c1f8 Explicitly check each exclusion in array instead of relying on implicit concatenation.
Add -d to docker compose up
Add --remove-orphans to docker compose down
2025-01-22 18:21:24 -08:00

25 lines
490 B
Bash
Executable File

#!/bin/bash
# Collect exclusions passed as arguments
exclusions=("$@")
for dir in /docker/*/
do
# Get the base folder name from path
folder=$(basename "$dir")
# Skip if folder is in the exclusions array
for exclusion in "${exclusions[@]}"; do
if [[ "$folder" = "$exclusion" ]]; then
continue 2
fi
done
cd "$dir" || {
echo "Failed to enter directory: $dir"
continue
}
docker compose down --remove-orphans
done