From 5f5435cec7b39a5c49291ea94a1f8e0aeef797f1 Mon Sep 17 00:00:00 2001 From: MyeonghoeLee Date: Tue, 31 Mar 2026 11:17:09 +0900 Subject: [PATCH] =?UTF-8?q?=EC=85=B8=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EC=95=88=EC=A0=95=EC=84=B1=20=EA=B0=9C=EC=84=A0=20?= =?UTF-8?q?(=EC=8B=A4=ED=96=89=20=ED=9D=90=EB=A6=84=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=20=EC=97=86=EC=9D=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - stop.sh/stop-mlx.sh: kill -9 → SIGTERM 후 2초 대기, 미종료 시 SIGKILL fallback - stop-mlx.sh/stop-ollama.sh: docker ps에 2>/dev/null 추가 (Docker 미실행 시 에러 억제) - stop-ollama.sh: brew 명령어 존재 여부 체크 추가 - setup.sh: VRAM_MB 빈 값 방어 코드 추가 (set -e 크래시 방지) - setup-ollama.sh: sleep 3 → 최대 15초 readiness 체크 루프로 교체 Co-Authored-By: Claude Opus 4.6 (1M context) --- setup-ollama.sh | 8 +++++++- setup.sh | 1 + stop-mlx.sh | 10 ++++++++-- stop-ollama.sh | 4 ++-- stop.sh | 8 +++++++- 5 files changed, 25 insertions(+), 6 deletions(-) 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