lastest changes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# View core_room logs
|
||||
# View mainroom logs
|
||||
#
|
||||
# Usage:
|
||||
# ./logs.sh # All logs
|
||||
@@ -11,9 +11,11 @@ set -e
|
||||
# Change to parent directory (services are in ../service_name)
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Export core_room/.env vars
|
||||
# Export mainroom/.env vars
|
||||
if [ -f ".env" ]; then
|
||||
export $(grep -v '^#' .env | grep -v '^$' | xargs)
|
||||
set -a
|
||||
source .env
|
||||
set +a
|
||||
fi
|
||||
|
||||
TARGET=${1:-all}
|
||||
@@ -27,19 +29,21 @@ for dir in */; do
|
||||
fi
|
||||
done
|
||||
|
||||
# ROOM_NAME comes from core_room/.env
|
||||
ROOM_NAME=${ROOM_NAME:-core_room}
|
||||
|
||||
if [[ " ${SERVICE_DIRS[@]} " =~ " ${TARGET} " ]]; then
|
||||
# Service directory logs
|
||||
cd "$TARGET" && docker compose logs -f
|
||||
elif [ "$TARGET" = "all" ]; then
|
||||
# All containers matching ROOM_NAME
|
||||
docker logs -f $(docker ps -q --filter "name=${ROOM_NAME}") 2>/dev/null || \
|
||||
echo "No ${ROOM_NAME} containers running"
|
||||
# All containers from all services
|
||||
echo "Tailing logs for: ${SERVICE_DIRS[*]}"
|
||||
for service in "${SERVICE_DIRS[@]}"; do
|
||||
cd "$service"
|
||||
docker compose logs -f &
|
||||
cd ..
|
||||
done
|
||||
wait
|
||||
else
|
||||
# Specific container name
|
||||
docker logs -f "${ROOM_NAME}_$TARGET" 2>/dev/null || \
|
||||
# Specific container name - try exact match
|
||||
docker logs -f "$TARGET" 2>/dev/null || \
|
||||
echo "Container not found: $TARGET"
|
||||
echo "Use service name (e.g., ./logs.sh soleprint) or full container name"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user