34 lines
617 B
Bash
34 lines
617 B
Bash
#!/bin/bash
|
|
# healthcheck.sh - Quick container health check for OpenClaw gateway
|
|
# Usage: healthcheck [--wait]
|
|
|
|
set -e
|
|
|
|
WAIT_MODE=false
|
|
if [ "$1" == "--wait" ]; then
|
|
WAIT_MODE=true
|
|
fi
|
|
|
|
check_health() {
|
|
if curl -sf http://localhost:8080/health > /dev/null 2>&1; then
|
|
echo "✓ Gateway healthy"
|
|
return 0
|
|
else
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
if [ "$WAIT_MODE" = true ]; then
|
|
echo "Waiting for gateway to be healthy..."
|
|
until check_health; do
|
|
sleep 1
|
|
done
|
|
else
|
|
if check_health; then
|
|
exit 0
|
|
else
|
|
echo "✗ Gateway not responding"
|
|
exit 1
|
|
fi
|
|
fi
|