#!/bin/bash
# TeachSeek 启动脚本
# 用法: ./start.sh [port] [db_profile]
# 示例: ./start.sh 8002 teach2
PORT="${1:-8001}"
DB_PROFILE="${2:-teach2}"
cd "$(dirname "$0")"
export ACTIVE_DB_PROFILE="$DB_PROFILE"
nohup ./teachseek --port "$PORT" > "/tmp/teachseek_${PORT}.log" 2>&1 &
PID=$!
echo "$PID" > "/tmp/teachseek_${PORT}.pid"
echo "TeachSeek已启动，PID: $PID，端口: $PORT，数据库: $DB_PROFILE"
echo "日志: /tmp/teachseek_${PORT}.log"
echo "停止: kill $PID"
