Files
worklog/start.sh
T
2026-10-29 16:27:34 +08:00

20 lines
585 B
Bash
Raw 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.
#!/usr/bin/env bash
# 启动脚本:安装依赖(首次)并启动 WorkLog 服务。
# 用法:bash start.sh
set -euo pipefail
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$PROJECT_DIR"
PYTHON="${PYTHON:-python}"
# 依赖未装时自动安装
if ! "$PYTHON" -c "import fastapi, uvicorn, sqlalchemy, aiosqlite, aiosmtplib, tomllib; from pydantic import field_validator" >/dev/null 2>&1; then
echo "安装依赖..."
"$PYTHON" -m pip install -r requirements.txt
fi
mkdir -p data
echo "启动 WorkLog:$PYTHON -m server.main"
exec "$PYTHON" -m server.main