Files
zTools2/deploy/ztools2.service
zikai 29c5462734 feat: 新增 systemd 持久化部署(deploy/ztools2.service + install-systemd.sh)
systemd 管理 zTools2 后端实现开机自启 + 崩溃自动重启:
- deploy/ztools2.service 模板(Restart=on-failure,after mysql)
- deploy/install-systemd.sh 自动检测 .venv 或系统 uvicorn,填充路径安装
- README 补持久化部署章节
2026-07-27 13:52:23 +08:00

24 lines
671 B
Desktop File
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.

[Unit]
Description=zikai file service (zTools2) - FastAPI backend
Documentation=https://git.zikai.wang/zikai/zTools2
After=network.target mysql.service
Wants=mysql.service
[Service]
Type=simple
# 工作目录与 uvicorn 路径:安装时由 install-systemd.sh 用实际路径替换
WorkingDirectory=__ZTOOLS2_DIR__
Environment=PYTHONUNBUFFERED=1
ExecStart=__UVICORN__ app.main:app --host 127.0.0.1 --port 6867 --workers 1
Restart=on-failure
RestartSec=3
# 后台转换可能耗时较长,放宽超时
TimeoutStopSec=30
KillSignal=SIGINT
# 日志走 journaldjournalctl -u ztools2
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target