nodebookls/start_all.sh
2025-10-29 13:56:24 +08:00

66 lines
1.7 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# TXT版轻量NotebookLM一键启动脚本 (Linux/macOS)
# 同时启动Redis, Celery Worker和主应用
echo "=========================================="
echo "TXT版轻量NotebookLM一键启动脚本"
echo "=========================================="
# 检查是否安装了Python
if ! command -v python3 &> /dev/null
then
echo "错误: 未找到Python请先安装Python"
exit 1
fi
# 检查是否安装了pip
if ! command -v pip3 &> /dev/null
then
echo "错误: 未找到pip请先安装pip"
exit 1
fi
# 检查是否存在requirements.txt
if [ ! -f "requirements.txt" ]; then
echo "错误: 未找到requirements.txt文件"
exit 1
fi
# 安装依赖
echo "正在安装依赖..."
pip3 install -r requirements.txt > /dev/null 2>&1
# 检查是否存在.env文件
if [ ! -f ".env" ]; then
echo "警告: 未找到.env文件请复制.env.example并配置相关参数"
fi
# 尝试启动Redis服务器 (假设已安装)
echo "正在尝试启动Redis服务器..."
if command -v redis-server &> /dev/null
then
redis-server > redis.log 2>&1 &
echo "Redis服务器启动中..."
else
echo "警告: 未找到redis-server命令请确保Redis已安装"
fi
sleep 3
# 启动Celery Worker
echo "正在启动Celery Worker..."
celery -A celery_app worker --loglevel=info > celery.log 2>&1 &
echo "Celery Worker启动中..."
sleep 5
# 启动应用
echo "正在启动主应用..."
echo "请在浏览器中访问 http://localhost:8000"
python3 main.py > app.log 2>&1 &
echo "=========================================="
echo "所有服务启动命令已发送"
echo "请等待几秒钟让服务完全启动"
echo "访问地址: http://localhost:8000"
echo "=========================================="