juc500 정상동작
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
# juc500 — 이 Mac에서 JUC500 GUI 프로세스를 종료하고 백그라운드로 다시 실행
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
is_windows() {
|
||||
case "$(uname -s 2>/dev/null || echo unknown)" in
|
||||
MINGW*|MSYS*|CYGWIN*) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
PY=""
|
||||
if is_windows && [[ -f "$ROOT/.venv/Scripts/python.exe" ]]; then
|
||||
PY="$ROOT/.venv/Scripts/python.exe"
|
||||
elif [[ -x "$ROOT/.venv/bin/python" ]]; then
|
||||
PY="$ROOT/.venv/bin/python"
|
||||
elif command -v python3 >/dev/null 2>&1; then
|
||||
PY="$(command -v python3)"
|
||||
else
|
||||
echo "python3 없음" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_DIR="$ROOT/.juc500"
|
||||
mkdir -p "$LOG_DIR"
|
||||
LOG_FILE="$LOG_DIR/restart.log"
|
||||
HOST_TAG="$(hostname -s 2>/dev/null || hostname)"
|
||||
|
||||
echo "[$HOST_TAG] JUC500 종료 중…"
|
||||
kill_msg="$(
|
||||
"$PY" -c "
|
||||
from juc500_xfer.wormhole_kill import kill_other_juc500_processes
|
||||
r = kill_other_juc500_processes(force=True)
|
||||
print(r.get('message') or '')
|
||||
" 2>/dev/null || true
|
||||
)"
|
||||
if [[ -n "${kill_msg}" ]]; then
|
||||
echo "[$HOST_TAG] $kill_msg"
|
||||
fi
|
||||
sleep 0.6
|
||||
|
||||
echo "[$HOST_TAG] JUC500 시작 중… (로그: $LOG_FILE)"
|
||||
if is_windows && [[ -f "$ROOT/start.sh" ]]; then
|
||||
nohup bash "$ROOT/start.sh" >>"$LOG_FILE" 2>&1 &
|
||||
elif is_windows; then
|
||||
WIN_ROOT="$ROOT"
|
||||
if command -v cygpath >/dev/null 2>&1; then
|
||||
WIN_ROOT="$(cygpath -w "$ROOT")"
|
||||
fi
|
||||
if [[ -f "$ROOT/start.bat" ]]; then
|
||||
nohup cmd.exe /c "ping 127.0.0.1 -n 3 >nul & cd /d \"$WIN_ROOT\" & call \"$WIN_ROOT\\start.bat\"" >>"$LOG_FILE" 2>&1 &
|
||||
elif [[ -f "$ROOT/start_win.sh" ]]; then
|
||||
nohup bash "$ROOT/start_win.sh" >>"$LOG_FILE" 2>&1 &
|
||||
else
|
||||
echo "[$HOST_TAG] start.sh / start.bat 없음" >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
nohup "$ROOT/start.sh" >>"$LOG_FILE" 2>&1 &
|
||||
fi
|
||||
echo "[$HOST_TAG] PID $!"
|
||||
Reference in New Issue
Block a user