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