Add --kill-ports flag and improve summary output
- Added --kill-ports flag to kill processes on supervisor and admin UI ports - Simplified summary: show Admin UI status inline (green URL or red error) - Combined log viewing into single command - Removed redundant error message during startup
This commit is contained in:
@@ -3,6 +3,30 @@
|
||||
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
PROJECT_DIR=$(cd "$SCRIPT_DIR/.." && pwd)
|
||||
|
||||
# Check for --kill-ports flag
|
||||
if [ "$1" = "--kill-ports" ]; then
|
||||
echo "Killing processes on ports..."
|
||||
PORT="${PORT:-3030}"
|
||||
ADMIN_UI_PORT="${ADMIN_UI_PORT:-8080}"
|
||||
|
||||
# Kill process on supervisor port
|
||||
SUPERVISOR_PID=$(lsof -ti:$PORT)
|
||||
if [ ! -z "$SUPERVISOR_PID" ]; then
|
||||
kill -9 $SUPERVISOR_PID 2>/dev/null
|
||||
echo " ✅ Killed process on port $PORT"
|
||||
fi
|
||||
|
||||
# Kill process on admin UI port
|
||||
UI_PID=$(lsof -ti:$ADMIN_UI_PORT)
|
||||
if [ ! -z "$UI_PID" ]; then
|
||||
kill -9 $UI_PID 2>/dev/null
|
||||
echo " ✅ Killed process on port $ADMIN_UI_PORT"
|
||||
fi
|
||||
|
||||
echo "Done"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Load environment variables
|
||||
source "$SCRIPT_DIR/environment.sh"
|
||||
|
||||
@@ -115,9 +139,10 @@ printf "🎨 Admin UI... "
|
||||
cd "$PROJECT_DIR/ui"
|
||||
|
||||
UI_STARTED=false
|
||||
UI_ERROR=""
|
||||
if ! command -v trunk &> /dev/null; then
|
||||
echo "⚠️"
|
||||
echo " Trunk not installed. Run: cargo install trunk"
|
||||
UI_ERROR="Trunk not installed. Run: cargo install trunk"
|
||||
else
|
||||
trunk serve --port "$ADMIN_UI_PORT" > /tmp/supervisor-ui.log 2>&1 &
|
||||
ADMIN_UI_PID=$!
|
||||
@@ -127,7 +152,7 @@ else
|
||||
UI_STARTED=true
|
||||
else
|
||||
echo "❌"
|
||||
echo " UI failed to start. Check logs: tail -f /tmp/supervisor-ui.log"
|
||||
UI_ERROR="Failed to start"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -138,13 +163,11 @@ echo "━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
echo "📡 OpenRPC Server: http://$BIND_ADDRESS:$PORT"
|
||||
if [ "$UI_STARTED" = true ]; then
|
||||
echo "🎨 Admin UI: http://127.0.0.1:$ADMIN_UI_PORT"
|
||||
else
|
||||
echo "🎨 Admin UI: ❌ $UI_ERROR"
|
||||
fi
|
||||
echo ""
|
||||
echo "Logs:"
|
||||
echo " Supervisor: tail -f /tmp/supervisor-run.log"
|
||||
if [ "$UI_STARTED" = true ]; then
|
||||
echo " Admin UI: tail -f /tmp/supervisor-ui.log"
|
||||
fi
|
||||
echo "Logs: tail -f /tmp/supervisor-run.log /tmp/supervisor-ui.log"
|
||||
echo ""
|
||||
echo "Press Ctrl+C to stop all services"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
Reference in New Issue
Block a user