update_docker_stacks.sh
· 421 B · Bash
Surowy
#!/bin/bash
ROOT_DIR="$1" # Root directory passed as an argument
find "$ROOT_DIR" -maxdepth 1 -type d -print0 | while IFS= read -r -d $'\0' dir; do
if [ -f "$dir/docker-compose.yaml" ]; then
echo "Processing: $dir"
(
cd "$dir" || exit 1 # Changed || to exit 1 for clearer error handling
docker compose pull && docker compose up -d
)
fi
done
echo "Completed processing all subdirectories."
| 1 | #!/bin/bash |
| 2 | |
| 3 | ROOT_DIR="$1" # Root directory passed as an argument |
| 4 | |
| 5 | find "$ROOT_DIR" -maxdepth 1 -type d -print0 | while IFS= read -r -d $'\0' dir; do |
| 6 | if [ -f "$dir/docker-compose.yaml" ]; then |
| 7 | echo "Processing: $dir" |
| 8 | ( |
| 9 | cd "$dir" || exit 1 # Changed || to exit 1 for clearer error handling |
| 10 | docker compose pull && docker compose up -d |
| 11 | ) |
| 12 | fi |
| 13 | done |
| 14 | |
| 15 | echo "Completed processing all subdirectories." |