Files
2026-05-16 23:27:38 +08:00

28 lines
1.1 KiB
Bash
Executable File
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
# 启动虚拟换装服务(统一 FastAPI,HTTPS 443 端口)
# ComfyUI 在外部机器运行;change_app.py 直接调用 service1/2/3 逻辑,无需单独启动子服务。
ROOT="/home/ubuntu/change_cloth_server"
LOG_DIR="/home/ubuntu/log"
mkdir -p "$LOG_DIR"
echo "[$(date '+%Y-%m-%d %H:%M:%S')] 停止旧进程..."
pkill -f "${ROOT}/change_app.py" 2>/dev/null && echo " 已停止 change_app" || echo " change_app 未在运行"
# 兼容:若旧的子服务仍在运行,一并停止
pkill -f "${ROOT}/change1/service1.py" 2>/dev/null && echo " 已停止 service1(旧)" || true
pkill -f "${ROOT}/change2/service2.py" 2>/dev/null && echo " 已停止 service2(旧)" || true
pkill -f "${ROOT}/change3/service3.py" 2>/dev/null && echo " 已停止 service3(旧)" || true
sleep 2
echo "[$(date '+%Y-%m-%d %H:%M:%S')] 启动 change_appHTTPS 443..."
export PATH="/home/ubuntu/.local/bin:$PATH"
nohup python3 "${ROOT}/change_app.py" >> "$LOG_DIR/change_app.log" 2>&1 &
echo " change_app 已启动 (PID: $!)"
echo "[$(date '+%Y-%m-%d %H:%M:%S')] 启动完毕。日志: $LOG_DIR/change_app.log"