diff --git a/setup-ollama.sh b/setup-ollama.sh index 9829489..f4a9de5 100755 --- a/setup-ollama.sh +++ b/setup-ollama.sh @@ -58,7 +58,13 @@ fi if ! brew services list | grep ollama | grep -q started; then brew services start ollama - sleep 3 + echo " Ollama 시작 대기 중..." + for i in $(seq 1 15); do + if curl -s http://localhost:11434/ > /dev/null 2>&1; then + break + fi + sleep 1 + done echo " ✓ Ollama 서비스 시작" else echo " ✓ Ollama 서비스 실행 중" diff --git a/setup.sh b/setup.sh index b444b90..28ea6eb 100755 --- a/setup.sh +++ b/setup.sh @@ -47,6 +47,7 @@ if command -v nvidia-smi &>/dev/null; then if nvidia-smi &>/dev/null; then HAS_NVIDIA_GPU=true VRAM_MB=$(nvidia-smi --query-gpu=memory.total --format=csv,noheader,nounits 2>/dev/null | head -1) + VRAM_MB=${VRAM_MB:-0} VRAM_GB=$((VRAM_MB / 1024)) fi fi diff --git a/stop-mlx.sh b/stop-mlx.sh index e263a8f..b033fcc 100755 --- a/stop-mlx.sh +++ b/stop-mlx.sh @@ -13,7 +13,7 @@ echo "============================================" echo "" # Open WebUI 컨테이너 종료 -if docker ps -q --filter name=open-webui-mlx | grep -q .; then +if docker ps -q --filter name=open-webui-mlx 2>/dev/null | grep -q .; then cd "$PROJECT_DIR" docker compose -f docker-compose.mlx.yml down 2>&1 | grep -v "^$" echo " ✓ Open WebUI 종료" @@ -24,7 +24,13 @@ fi # vllm-mlx 서버 종료 PIDS=$(lsof -ti :$PORT 2>/dev/null || true) if [ -n "$PIDS" ]; then - echo "$PIDS" | xargs kill -9 2>/dev/null || true + echo "$PIDS" | xargs kill -15 2>/dev/null || true + sleep 2 + # 아직 살아있으면 강제 종료 + REMAINING=$(lsof -ti :$PORT 2>/dev/null || true) + if [ -n "$REMAINING" ]; then + echo "$REMAINING" | xargs kill -9 2>/dev/null || true + fi echo " ✓ vllm-mlx 서버 종료 (포트 $PORT)" else echo " - vllm-mlx 서버 없음 (이미 종료됨)" diff --git a/stop-ollama.sh b/stop-ollama.sh index a6fa10d..ab7382a 100755 --- a/stop-ollama.sh +++ b/stop-ollama.sh @@ -12,7 +12,7 @@ echo "============================================" echo "" # Open WebUI 컨테이너 종료 -if docker ps -q --filter name=open-webui | grep -q .; then +if docker ps -q --filter name=open-webui 2>/dev/null | grep -q .; then cd "$PROJECT_DIR" docker compose down 2>&1 | grep -v "^$" echo " ✓ Open WebUI 종료" @@ -21,7 +21,7 @@ else fi # Ollama 서비스 종료 -if brew services list 2>/dev/null | grep ollama | grep -q started; then +if command -v brew &>/dev/null && brew services list 2>/dev/null | grep ollama | grep -q started; then brew services stop ollama echo " ✓ Ollama 서비스 종료" else diff --git a/stop.sh b/stop.sh index 43c020d..49ba62d 100755 --- a/stop.sh +++ b/stop.sh @@ -34,7 +34,13 @@ fi PIDS=$(lsof -ti :8090 2>/dev/null || true) if [ -n "$PIDS" ]; then echo " [MLX] vllm-mlx 서버 감지됨 → 종료 중..." - echo "$PIDS" | xargs kill -9 2>/dev/null || true + echo "$PIDS" | xargs kill -15 2>/dev/null || true + sleep 2 + # 아직 살아있으면 강제 종료 + REMAINING=$(lsof -ti :8090 2>/dev/null || true) + if [ -n "$REMAINING" ]; then + echo "$REMAINING" | xargs kill -9 2>/dev/null || true + fi echo " ✓ vllm-mlx 서버 종료" STOPPED=true fi