21 lines
578 B
Bash
21 lines
578 B
Bash
#!/bin/bash
|
||
cd "$(dirname "$0")"
|
||
# 2. 杀掉占用端口的进程
|
||
pkill -f 'python run.py'
|
||
# 创建虚拟环境 (首次运行)
|
||
if [ ! -d "venv" ]; then
|
||
echo "创建虚拟环境..."
|
||
python3 -m venv venv
|
||
source venv/bin/activate
|
||
pip install -r requirements.txt
|
||
else
|
||
source venv/bin/activate
|
||
fi
|
||
|
||
# 启动服务 (端口8000, 关闭热重载)
|
||
echo "启动 CursorPro 后台 (端口: 8000)..."
|
||
RELOAD=false nohup python run.py > cursorpro.log 2>&1 &
|
||
echo $! > cursorpro.pid
|
||
echo "服务已启动,PID: $(cat cursorpro.pid)"
|
||
echo "日志: tail -f cursorpro.log"
|