Upload 5 files
Browse files- start-openclaw.sh +3 -2
- sync.py +5 -0
start-openclaw.sh
CHANGED
|
@@ -55,11 +55,12 @@ say "providers='${PROVIDERS:-<unset, single-provider compat via OPENAI_* >}' mod
|
|
| 55 |
# 3. 生成配置(本地文件写入,秒级完成)
|
| 56 |
timeout 120 python3 /app/sync.py generate_config || say "WARN: generate_config failed, gateway may start without providers"
|
| 57 |
|
|
|
|
| 58 |
timeout 60 openclaw config set model.thinking false 2>/dev/null || true
|
| 59 |
timeout 60 openclaw config set fastMode.enabled true 2>/dev/null || true
|
| 60 |
timeout 60 openclaw config set stream true 2>/dev/null || true
|
| 61 |
|
| 62 |
-
#
|
| 63 |
# 不能用 0.0.0.0/0:那会让 X-Forwarded-For 链里所有 IP 都被跳过,反而解析不到客户端 IP。
|
| 64 |
python3 -c "
|
| 65 |
import json, os
|
|
@@ -83,7 +84,7 @@ if [ "$QQ_BOT_ENABLED" = "true" ]; then
|
|
| 83 |
|| say "QQ channel add skipped (may already exist)"
|
| 84 |
fi
|
| 85 |
|
| 86 |
-
#
|
| 87 |
graceful_shutdown() {
|
| 88 |
say "shutdown signal received, running final backup..."
|
| 89 |
timeout 300 python3 /app/sync.py backup || true
|
|
|
|
| 55 |
# 3. 生成配置(本地文件写入,秒级完成)
|
| 56 |
timeout 120 python3 /app/sync.py generate_config || say "WARN: generate_config failed, gateway may start without providers"
|
| 57 |
|
| 58 |
+
|
| 59 |
timeout 60 openclaw config set model.thinking false 2>/dev/null || true
|
| 60 |
timeout 60 openclaw config set fastMode.enabled true 2>/dev/null || true
|
| 61 |
timeout 60 openclaw config set stream true 2>/dev/null || true
|
| 62 |
|
| 63 |
+
# 5. 强制信任 HF 反向代理(纯文件写入,必须在 gateway 之前)
|
| 64 |
# 不能用 0.0.0.0/0:那会让 X-Forwarded-For 链里所有 IP 都被跳过,反而解析不到客户端 IP。
|
| 65 |
python3 -c "
|
| 66 |
import json, os
|
|
|
|
| 84 |
|| say "QQ channel add skipped (may already exist)"
|
| 85 |
fi
|
| 86 |
|
| 87 |
+
# 6. 优雅退出:关停前做一次备份
|
| 88 |
graceful_shutdown() {
|
| 89 |
say "shutdown signal received, running final backup..."
|
| 90 |
timeout 300 python3 /app/sync.py backup || true
|
sync.py
CHANGED
|
@@ -79,6 +79,7 @@ def backup():
|
|
| 79 |
("credentials", os.path.join(OPENCLAW_DIR, "credentials")),
|
| 80 |
("cron", os.path.join(OPENCLAW_DIR, "cron")),
|
| 81 |
("agents/main/agent", os.path.join(OPENCLAW_DIR, "agents", "main", "agent")),
|
|
|
|
| 82 |
]
|
| 83 |
|
| 84 |
if workspace:
|
|
@@ -88,6 +89,10 @@ def backup():
|
|
| 88 |
if os.path.exists(fpath):
|
| 89 |
paths_to_backup.append((f"workspace/{fname}", fpath))
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
with tarfile.open(FILENAME, "w:gz") as tar:
|
| 92 |
for arcname, p in paths_to_backup:
|
| 93 |
if os.path.exists(p):
|
|
|
|
| 79 |
("credentials", os.path.join(OPENCLAW_DIR, "credentials")),
|
| 80 |
("cron", os.path.join(OPENCLAW_DIR, "cron")),
|
| 81 |
("agents/main/agent", os.path.join(OPENCLAW_DIR, "agents", "main", "agent")),
|
| 82 |
+
("skills", os.path.join(OPENCLAW_DIR, "skills")),
|
| 83 |
]
|
| 84 |
|
| 85 |
if workspace:
|
|
|
|
| 89 |
if os.path.exists(fpath):
|
| 90 |
paths_to_backup.append((f"workspace/{fname}", fpath))
|
| 91 |
|
| 92 |
+
workspace_skills = os.path.join(workspace, "skills")
|
| 93 |
+
if os.path.exists(workspace_skills):
|
| 94 |
+
paths_to_backup.append(("workspace/skills", workspace_skills))
|
| 95 |
+
|
| 96 |
with tarfile.open(FILENAME, "w:gz") as tar:
|
| 97 |
for arcname, p in paths_to_backup:
|
| 98 |
if os.path.exists(p):
|