Stage 4
This commit is contained in:
39
test/scripts/start_server_bg.sh
Normal file
39
test/scripts/start_server_bg.sh
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
cd "$PROJECT_ROOT"
|
||||
echo "PROJECT_ROOT: $PROJECT_ROOT"
|
||||
# Очистка
|
||||
echo "Stopping old processes..."
|
||||
pkill beam 2>/dev/null || true
|
||||
rm -rf Mnesia.*
|
||||
sleep 2
|
||||
|
||||
# Компиляция
|
||||
echo "Compiling..."
|
||||
rebar3 compile > /dev/null 2>&1
|
||||
|
||||
# Запуск в фоне через erl
|
||||
echo "Starting server in background..."
|
||||
erl -sname eventhub_test \
|
||||
-pa _build/default/lib/*/ebin \
|
||||
-eval "application:ensure_all_started(eventhub)" \
|
||||
-noshell \
|
||||
-detached
|
||||
|
||||
# Ждём запуска
|
||||
echo "Waiting for server..."
|
||||
for i in {1..30}; do
|
||||
if curl -s http://localhost:8080/health 2>/dev/null | grep -q "ok"; then
|
||||
echo "✓ Server ready at http://localhost:8080"
|
||||
pgrep -f "beam.*eventhub_test"
|
||||
exit 0
|
||||
fi
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "✗ Server failed to start"
|
||||
pkill beam 2>/dev/null || true
|
||||
exit 1
|
||||
Reference in New Issue
Block a user