first commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
[Unit]
|
||||
Description=手工交易子代理 Binance(复制为 manual-agent-binance.service 并修改路径)
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=YOUR_USER
|
||||
WorkingDirectory=YOUR_REPO/crypto_monitor_binance
|
||||
Environment=PATH=YOUR_REPO/manual_trading_hub/.venv/bin:/usr/bin:/bin
|
||||
Environment=EXCHANGE=binance
|
||||
Environment=PORT=15200
|
||||
Environment=HOST=127.0.0.1
|
||||
EnvironmentFile=-YOUR_REPO/crypto_monitor_binance/.env
|
||||
ExecStart=YOUR_REPO/manual_trading_hub/.venv/bin/python YOUR_REPO/manual_trading_hub/agent.py
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=手工交易中控 hub(复制到 /etc/systemd/system/manual-hub.service 并修改路径)
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=YOUR_USER
|
||||
WorkingDirectory=YOUR_REPO/manual_trading_hub
|
||||
Environment=HUB_HOST=0.0.0.0
|
||||
Environment=HUB_TRUST_LAN=1
|
||||
Environment=HUB_PORT=5100
|
||||
ExecStart=YOUR_REPO/manual_trading_hub/.venv/bin/python YOUR_REPO/manual_trading_hub/hub.py
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env bash
|
||||
# 一键用 screen 后台启动 3 个子代理(不含 OKX):Binance:15200、Gate:15202、Gate-Bot:15203
|
||||
# 用法:在任意目录执行 bash /path/to/manual_trading_hub/scripts/start_agents_3screen.sh
|
||||
# 若 hub 单独在 /opt/manual_trading_hub,四个策略目录在别的路径,请先:
|
||||
# export MANUAL_TRADING_REPO_ROOT=/path/to/含_crypto_monitor_*_的目录
|
||||
# 依赖:各策略目录已 cp .env.example .env 并配置;manual_trading_hub/.venv 已 pip install -r requirements.txt
|
||||
# 日志:manual_trading_hub/logs/<会话名>.log(若 screen 里进程秒退,tail 该文件排查)
|
||||
# 查看:screen -ls 接入:screen -r mt-agent-bn 停:./stop_agents_3screen.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
HUB_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||
if [[ -n "${MANUAL_TRADING_REPO_ROOT:-}" ]]; then
|
||||
REPO_ROOT="$(cd "${MANUAL_TRADING_REPO_ROOT}" && pwd)"
|
||||
else
|
||||
REPO_ROOT="$(cd "${HUB_DIR}/.." && pwd)"
|
||||
fi
|
||||
AGENT_PY="${HUB_DIR}/agent.py"
|
||||
VENV_PY="${HUB_DIR}/.venv/bin/python"
|
||||
LOG_DIR="${HUB_DIR}/logs"
|
||||
mkdir -p "${LOG_DIR}"
|
||||
|
||||
echo "REPO_ROOT=${REPO_ROOT} (其下应有 crypto_monitor_binance、crypto_monitor_gate 等目录)"
|
||||
|
||||
if ! command -v screen >/dev/null 2>&1; then
|
||||
echo "未找到 screen,请先安装:sudo apt install screen" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${VENV_PY}" ]]; then
|
||||
echo "未找到 ${VENV_PY},请先在 manual_trading_hub 下创建 venv 并 pip install -r requirements.txt" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${AGENT_PY}" ]]; then
|
||||
echo "未找到 agent.py:${AGENT_PY}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
start_one() {
|
||||
local name="$1" subdir="$2" exchange="$3" port="$4"
|
||||
local work="${REPO_ROOT}/${subdir}"
|
||||
local logf="${LOG_DIR}/${name}.log"
|
||||
if [[ ! -d "${work}" ]]; then
|
||||
echo "目录不存在,跳过:${work}" >&2
|
||||
echo " 若项目在别处,请设置 export MANUAL_TRADING_REPO_ROOT=/正确上级目录 后重跑" >&2
|
||||
return 1
|
||||
fi
|
||||
if screen -ls 2>/dev/null | grep -qF ".${name}"; then
|
||||
echo "已存在会话 ${name},跳过。要重建请先: screen -S ${name} -X quit" >&2
|
||||
return 0
|
||||
fi
|
||||
screen -dmS "${name}" bash -c "
|
||||
cd '${work}' || { echo 'cd failed' >>'${logf}'; exit 1; }
|
||||
set -a
|
||||
if [[ -f .env ]]; then
|
||||
. ./.env
|
||||
fi
|
||||
set +a
|
||||
export EXCHANGE='${exchange}' PORT='${port}' HOST=127.0.0.1
|
||||
exec '${VENV_PY}' '${AGENT_PY}' >>'${logf}' 2>&1
|
||||
"
|
||||
sleep 0.5
|
||||
if screen -ls 2>/dev/null | grep -qF ".${name}"; then
|
||||
echo "已启动 screen:${name} (${subdir} EXCHANGE=${exchange} PORT=${port}) 日志:${logf}"
|
||||
else
|
||||
echo "错误:${name} 启动后立刻退出。请执行: tail -80 '${logf}'" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
start_one "mt-agent-bn" "crypto_monitor_binance" "binance" "15200"
|
||||
start_one "mt-agent-gate" "crypto_monitor_gate" "gate" "15202"
|
||||
start_one "mt-agent-gatebot" "crypto_monitor_gate_bot" "gate" "15203"
|
||||
|
||||
echo ""
|
||||
echo "下一步(一键中控 screen):"
|
||||
echo " chmod +x ${SCRIPT_DIR}/start_hub_screen.sh && ${SCRIPT_DIR}/start_hub_screen.sh"
|
||||
echo "或手动:cd ${HUB_DIR} && source .venv/bin/activate && export HUB_AGENTS=... && python hub.py"
|
||||
echo ""
|
||||
echo "查看会话: screen -ls"
|
||||
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
# 一键用 screen 后台启动中控 hub.py(默认对接 3 个 agent:不含 OKX)
|
||||
# 用法:先启动 3 个 agent(start_agents_3screen.sh),再执行本脚本
|
||||
# bash /path/to/manual_trading_hub/scripts/start_hub_screen.sh
|
||||
# 可在运行前 export 覆盖:HUB_AGENTS、HUB_AGENT_NAMES、HUB_HOST、HUB_PORT、CONTROL_TOKEN、HUB_TRUST_LAN
|
||||
# 默认 HUB_HOST=0.0.0.0、HUB_TRUST_LAN=1(局域网可访问私网 IP)。仅本机: export HUB_HOST=127.0.0.1 HUB_TRUST_LAN=0
|
||||
# 查看:screen -ls 接入:screen -r mt-hub 停:./stop_hub_screen.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
HUB_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||
VENV_PY="${HUB_DIR}/.venv/bin/python"
|
||||
HUB_PY="${HUB_DIR}/hub.py"
|
||||
|
||||
HUB_AGENTS="${HUB_AGENTS:-http://127.0.0.1:15200,http://127.0.0.1:15202,http://127.0.0.1:15203}"
|
||||
# 不设 HUB_AGENT_NAMES 时不在此写死,由 hub.py 里 _DEFAULT_FOLDER_LABELS 生效;要覆盖可: export HUB_AGENT_NAMES="名1,名2,名3" 或写在 manual_trading_hub/.env
|
||||
HUB_AGENT_NAMES="${HUB_AGENT_NAMES:-}"
|
||||
HUB_HOST="${HUB_HOST:-0.0.0.0}"
|
||||
HUB_PORT="${HUB_PORT:-5100}"
|
||||
HUB_TRUST_LAN="${HUB_TRUST_LAN:-1}"
|
||||
|
||||
if ! command -v screen >/dev/null 2>&1; then
|
||||
echo "未找到 screen,请先安装:sudo apt install screen" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${VENV_PY}" ]]; then
|
||||
echo "未找到 ${VENV_PY},请先在 manual_trading_hub 下创建 venv 并 pip install -r requirements.txt" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${HUB_PY}" ]]; then
|
||||
echo "未找到 hub.py:${HUB_PY}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if screen -ls 2>/dev/null | grep -qF ".mt-hub"; then
|
||||
echo "已存在会话 mt-hub,跳过。要重建请先: screen -S mt-hub -X quit" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 仅当外层显式设置了 HUB_AGENT_NAMES 时才 export,避免 export 空串覆盖 .env 里已有配置
|
||||
EXTRA_NAMES=""
|
||||
if [[ -n "${HUB_AGENT_NAMES:-}" ]]; then
|
||||
EXTRA_NAMES="export HUB_AGENT_NAMES=$(printf '%q' "${HUB_AGENT_NAMES}")"
|
||||
fi
|
||||
|
||||
screen -dmS mt-hub bash -c "
|
||||
set -e
|
||||
cd '${HUB_DIR}'
|
||||
set -a
|
||||
if [[ -f .env ]]; then
|
||||
. ./.env
|
||||
fi
|
||||
set +a
|
||||
export HUB_AGENTS='${HUB_AGENTS}'
|
||||
${EXTRA_NAMES}
|
||||
export HUB_HOST='${HUB_HOST}'
|
||||
export HUB_PORT='${HUB_PORT}'
|
||||
export HUB_TRUST_LAN='${HUB_TRUST_LAN}'
|
||||
exec '${VENV_PY}' '${HUB_PY}'
|
||||
"
|
||||
|
||||
echo "已启动 screen:mt-hub"
|
||||
echo " HUB_AGENTS=${HUB_AGENTS}"
|
||||
if [[ -n "${HUB_AGENT_NAMES}" ]]; then
|
||||
echo " HUB_AGENT_NAMES=${HUB_AGENT_NAMES}"
|
||||
else
|
||||
echo " HUB_AGENT_NAMES=(未设,使用 hub.py 内 _DEFAULT_FOLDER_LABELS)"
|
||||
fi
|
||||
echo " 监听:${HUB_HOST}:${HUB_PORT} HUB_TRUST_LAN=${HUB_TRUST_LAN}(默认允许私网访问中控)"
|
||||
echo " 本机:http://127.0.0.1:${HUB_PORT}/ 局域网:http://<本机局域网IP>:${HUB_PORT}/"
|
||||
echo " 仅本机请: export HUB_HOST=127.0.0.1 HUB_TRUST_LAN=0 后重启本脚本"
|
||||
echo "接入: screen -r mt-hub"
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# 关闭 start_agents_3screen.sh 启动的 3 个 screen 会话
|
||||
set -euo pipefail
|
||||
for s in mt-agent-bn mt-agent-gate mt-agent-gatebot; do
|
||||
if screen -ls 2>/dev/null | grep -qF ".${s}"; then
|
||||
screen -S "${s}" -X quit && echo "已关闭:${s}" || true
|
||||
else
|
||||
echo "未运行:${s}"
|
||||
fi
|
||||
done
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# 关闭 start_hub_screen.sh 启动的中控 screen 会话
|
||||
set -euo pipefail
|
||||
if screen -ls 2>/dev/null | grep -qF ".mt-hub"; then
|
||||
screen -S mt-hub -X quit && echo "已关闭:mt-hub" || true
|
||||
else
|
||||
echo "未运行:mt-hub"
|
||||
fi
|
||||
@@ -0,0 +1,191 @@
|
||||
# Ubuntu 后台运行(中控 + 子代理)
|
||||
|
||||
各 `crypto_monitor_*` 策略目录:首次 **`cp .env.example .env`** 并编辑;**`.env` 不进 Git**,`git pull` 不覆盖。升级前建议 `cp .env .env.backup.$(date +%Y%m%d)`。子代理启动前须 **`source` 该目录 `.env`**(见下文)。
|
||||
|
||||
前台跑 `python agent.py` / `python hub.py` 时,关掉终端进程会结束。要**常驻后台**,可用下面三种之一(推荐 **systemd**)。
|
||||
|
||||
---
|
||||
|
||||
## 一、tmux / screen(最简单,适合先试用)
|
||||
|
||||
仓库已提供 **一键起 3 个 agent(不含 OKX)** 的 screen 脚本(需可执行权限):
|
||||
|
||||
```bash
|
||||
chmod +x manual_trading_hub/scripts/start_agents_3screen.sh
|
||||
chmod +x manual_trading_hub/scripts/start_hub_screen.sh
|
||||
chmod +x manual_trading_hub/scripts/stop_agents_3screen.sh
|
||||
chmod +x manual_trading_hub/scripts/stop_hub_screen.sh
|
||||
./manual_trading_hub/scripts/start_agents_3screen.sh
|
||||
./manual_trading_hub/scripts/start_hub_screen.sh
|
||||
# 关闭:
|
||||
./manual_trading_hub/scripts/stop_hub_screen.sh
|
||||
./manual_trading_hub/scripts/stop_agents_3screen.sh
|
||||
```
|
||||
|
||||
脚本默认认为:`manual_trading_hub` 的**上一级目录**里并列放着三个 `crypto_monitor_*`。若你把 hub 单独放在 `/opt/crypto_monitor/manual_trading_hub`,而策略项目在例如 `/opt/crypto_monitor/` 下的其他位置,请先执行
|
||||
`export MANUAL_TRADING_REPO_ROOT=/opt/crypto_monitor` 再运行 `start_agents_3screen.sh`。
|
||||
启动后若 `screen -ls` 里没有 `mt-agent-*`,看日志:`tail -80 /opt/crypto_monitor/manual_trading_hub/logs/mt-agent-bn.log`。
|
||||
|
||||
### 局域网内其他电脑访问中控
|
||||
|
||||
中控 **默认** `HUB_HOST=0.0.0.0`、`HUB_TRUST_LAN=开启`,同一局域网内可用 `http://<中控机局域网IP>:5100/` 打开页面(本机仍可用 `http://127.0.0.1:5100/`)。请确保防火墙放行端口,例如:`sudo ufw allow 5100/tcp`。
|
||||
|
||||
若改为 **仅本机** 访问:`HUB_HOST=127.0.0.1` 或 `HUB_TRUST_LAN=0`,重启 hub。
|
||||
|
||||
也可把上述变量写进 `manual_trading_hub/.env`,再用 `start_hub_screen.sh` 启动。
|
||||
|
||||
以下为手工 tmux 示例:
|
||||
|
||||
```bash
|
||||
# 新建会话,在里面照常启动 agent 或 hub,然后按键 Ctrl+B 再按 D 脱离
|
||||
tmux new -s hub
|
||||
cd /opt/crypto_monitor/manual_trading_hub && source .venv/bin/activate && python hub.py
|
||||
# Ctrl+B, D
|
||||
|
||||
tmux new -s agent-bn
|
||||
cd /opt/crypto_monitor/crypto_monitor_binance && set -a && source .env && set +a
|
||||
export EXCHANGE=binance PORT=15200 HOST=127.0.0.1
|
||||
source /opt/crypto_monitor/manual_trading_hub/.venv/bin/activate
|
||||
python /opt/crypto_monitor/manual_trading_hub/agent.py
|
||||
# Ctrl+B, D
|
||||
```
|
||||
|
||||
重新连上:`tmux attach -t hub`
|
||||
|
||||
---
|
||||
|
||||
## 二、nohup(快速、无守护重启)
|
||||
|
||||
```bash
|
||||
cd /opt/crypto_monitor/manual_trading_hub
|
||||
source .venv/bin/activate
|
||||
nohup python hub.py > /tmp/manual-hub.log 2>&1 &
|
||||
```
|
||||
|
||||
子代理同理(每个账户一条):**先 `source` 该策略目录的 `.env`**(`agent.py` 不会自己读文件),再 `nohup python …/agent.py`。
|
||||
|
||||
停进程:`ps aux | grep hub.py` 或 `grep agent.py`,再 `kill <pid>`。
|
||||
|
||||
---
|
||||
|
||||
## 三、systemd(推荐:开机自启、崩溃自动拉起)
|
||||
|
||||
1. 把下面两个示例里的 **`YOUR_REPO`** 改成 **`/opt/crypto_monitor`**(或你本机实际仓库根目录),`YOUR_USER` 改成 Linux 用户名。
|
||||
2. 复制到 `/etc/systemd/system/`(需 sudo),文件名例如 `manual-hub.service`、`manual-agent-binance.service`。
|
||||
3. 执行:
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now manual-hub.service
|
||||
sudo systemctl enable --now manual-agent-binance.service
|
||||
# 其余 OKX / Gate 同理再建 3 个 unit 或合并为多条
|
||||
```
|
||||
|
||||
查看状态:`sudo systemctl status manual-hub`
|
||||
日志:`journalctl -u manual-hub -f`
|
||||
|
||||
### 示例:`/etc/systemd/system/manual-hub.service`
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=手工交易中控 hub
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=YOUR_USER
|
||||
WorkingDirectory=YOUR_REPO/manual_trading_hub
|
||||
Environment=HUB_HOST=0.0.0.0
|
||||
Environment=HUB_TRUST_LAN=1
|
||||
Environment=HUB_PORT=5100
|
||||
ExecStart=YOUR_REPO/manual_trading_hub/.venv/bin/python YOUR_REPO/manual_trading_hub/hub.py
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
**注意:** `agent.py` **不会**像 Flask 那样自动加载目录里的 `.env`,密钥必须由 **systemd 的 `EnvironmentFile=`** 注入,或用下面 `bash -c` 方式 `source .env` 后再启动。
|
||||
|
||||
### 示例:`/etc/systemd/system/manual-agent-binance.service`
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=手工交易子代理 Binance
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=YOUR_USER
|
||||
WorkingDirectory=YOUR_REPO/crypto_monitor_binance
|
||||
Environment=PATH=YOUR_REPO/manual_trading_hub/.venv/bin:/usr/bin:/bin
|
||||
Environment=EXCHANGE=binance
|
||||
Environment=PORT=15200
|
||||
Environment=HOST=127.0.0.1
|
||||
# 把该账户的 .env 注入进程(与 Flask 同一份即可;仅支持 KEY=VALUE 行,勿写 shell 语法)
|
||||
EnvironmentFile=-YOUR_REPO/crypto_monitor_binance/.env
|
||||
ExecStart=YOUR_REPO/manual_trading_hub/.venv/bin/python YOUR_REPO/manual_trading_hub/agent.py
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
若 `.env` 含 **systemd 无法解析** 的内容(复杂引号、`export` 等),改用:
|
||||
|
||||
```ini
|
||||
ExecStart=/bin/bash -lc 'set -a; source YOUR_REPO/crypto_monitor_binance/.env; set +a; exec YOUR_REPO/manual_trading_hub/.venv/bin/python YOUR_REPO/manual_trading_hub/agent.py'
|
||||
```
|
||||
|
||||
并删掉或注释掉 `EnvironmentFile=` 行,避免重复注入。
|
||||
|
||||
**OKX / Gate / Gate-Bot**:各复制一份 `.service`,改 `Description`、`WorkingDirectory`、以及 `EXCHANGE` / `PORT`(`15201`、`15202`、`15203`)。
|
||||
|
||||
---
|
||||
|
||||
## 四、常见问题(子代理 / screen / 依赖)
|
||||
|
||||
1. **`curl http://127.0.0.1:15202/status`(或其它端口)返回 `ok:false`,错误里提到 pysocks / SOCKS**
|
||||
策略目录 `.env` 里配置了 `GATE_SOCKS_PROXY`(或 `BINANCE_SOCKS_PROXY`、`OKX_SOCKS_PROXY`)时,ccxt 需要 **PySocks**。在 **`/opt/crypto_monitor/manual_trading_hub/.venv`**(或你本机的 `manual_trading_hub/.venv`)中执行:
|
||||
`pip install PySocks` 或 `pip install -r requirements.txt`。
|
||||
|
||||
2. **已经 `pip install PySocks`,错误文案完全不变**
|
||||
子代理是**常驻进程**,首次请求已创建 ccxt;在运行中的进程里**仅安装包不会自动生效**。须**重启**该 agent:例如
|
||||
`screen -S mt-agent-gate -X quit`
|
||||
再执行 `start_agents_3screen.sh`(或你的等价启动方式)。**不要**依赖「会话还在、以为已经更新」的旧进程。
|
||||
|
||||
3. **`start_agents_3screen.sh` 打印「已存在会话、跳过」**
|
||||
脚本检测到 `mt-agent-*` 已在跑会跳过创建。需要先停再启:
|
||||
`./stop_agents_3screen.sh`
|
||||
或对单个会话:`screen -S mt-agent-gate -X quit`,再跑启动脚本。
|
||||
|
||||
4. **确认 15200/15202/15203 上的进程用的是 hub 的 venv**
|
||||
```bash
|
||||
ps aux | grep agent.py
|
||||
tr '\0' ' ' < /proc/<PID>/cmdline; echo
|
||||
```
|
||||
应看到 `…/manual_trading_hub/.venv/bin/python` 与 `…/manual_trading_hub/agent.py`。若用的是系统 `python3`,要么在**同一解释器环境**里装依赖,要么改为用 `start_agents_3screen.sh` 启动(脚本内写死 `VENV_PY`)。
|
||||
|
||||
5. **中控某账户一直红 / 非 JSON**
|
||||
对应该端口的 agent 未启动,或 `HUB_AGENTS` 与 agent 的 `PORT` 不一致。本机先测:
|
||||
`curl -sS http://127.0.0.1:1520x/status | head -c 400`
|
||||
再看 `logs/mt-agent-*.log`。
|
||||
|
||||
6. **子代理端口与 Flask 冲突**
|
||||
agent 使用环境变量 **`PORT`**(脚本里 15200、15202、15203);各策略 `.env` 里的 **`APP_PORT`** 给 Flask。二者**不能**相同。
|
||||
|
||||
7. **systemd 下改依赖或 `.env` 后**
|
||||
与 screen 相同:`pip install` 或改 `EnvironmentFile` 后需 **`systemctl restart <unit>`**,否则仍是旧进程。
|
||||
|
||||
---
|
||||
|
||||
## 五、注意
|
||||
|
||||
- 子代理与中控仍建议只监听 **127.0.0.1**;Flask 的 `APP_HOST=0.0.0.0` 与中控无关。
|
||||
- 若策略项目用**自己的** `.venv`,把 `ExecStart` 里的 Python 改成该 venv 的 `python`,但 `agent.py` 路径仍指向 `manual_trading_hub/agent.py`。
|
||||
|
||||
同目录下另有 `example-systemd/*.service.example` 可复制后改路径使用。
|
||||
Reference in New Issue
Block a user