Files
soleprint/cfg/amar/ctrl/logs.sh
2025-12-31 08:21:07 -03:00

34 lines
767 B
Bash
Executable File

#!/bin/bash
# View amar room logs
#
# Usage:
# ./logs.sh # All logs (tail)
# ./logs.sh -f # Follow mode
# ./logs.sh backend # Specific container
# ./logs.sh soleprint # Soleprint logs
set -e
cd "$(dirname "$0")/.."
FOLLOW=""
TARGET=""
for arg in "$@"; do
case $arg in
-f|--follow) FOLLOW="-f" ;;
*) TARGET="$arg" ;;
esac
done
if [ -z "$TARGET" ]; then
echo "=== Amar ==="
docker compose logs --tail=20 $FOLLOW
echo ""
echo "=== Soleprint ==="
(cd soleprint && docker compose logs --tail=20 $FOLLOW)
elif [ "$TARGET" = "soleprint" ]; then
(cd soleprint && docker compose logs $FOLLOW)
else
docker logs $FOLLOW "amar_$TARGET" 2>/dev/null || docker logs $FOLLOW "$TARGET"
fi