返回博客
OpenClaw Gateway 与通道笔记:daemon、doctor、channels
基于 [email protected] 的真实 --help:Gateway 怎么起、daemon 管什么、channels 怎么列状态,以及 Telegram 接入时该守的底线。
承接 安装笔记。
本机已确认 CLI 为 OpenClaw 2026.7.1-2 (0790d9f)。下面命令均来自该版本的 --help,不是编的子命令。
1. 三个容易混的概念
| 概念 | CLI | 作用 |
|---|---|---|
| Gateway | openclaw gateway |
WebSocket 网关进程:会话、通道、agent 都挂在这上面 |
| Daemon / 服务 | openclaw daemon |
把 Gateway 装成系统服务(Windows:schtasks;Linux:systemd;macOS:launchd) |
| Channels | openclaw channels |
Telegram / Discord 等聊天通道的增删与状态 |
日常目标通常是:
onboard 配好模型与通道
→ daemon 常驻
→ doctor / health 能绿
→ 手机或 TUI 能对话
2. Gateway
openclaw gateway --help
要点:
- 可指定
--port、--bind(loopback/lan/tailnet/auto/custom) - 认证:
--auth支持none|token|password|trusted-proxy --dev:缺配置时建 dev 配置与 workspace--force:启动前清掉占用端口的旧监听
前台调试可以:
openclaw gateway
# 或看状态类子命令(以 gateway --help 的 subcommands 为准)
生产环境更常见的是服务化,而不是 SSH 里挂一个前台进程。
3. Daemon(服务)
openclaw daemon --help
子命令(help 原文):
install/uninstallstart/stop/restartstatus(安装状态 + 连通/能力探测)
和 onboard 的关系:官方推荐路径里有
openclaw onboard --install-daemon
等于向导里顺手装服务。若你已经 onboard 过但没装服务:
openclaw daemon install
openclaw daemon status
openclaw daemon restart
Windows 上对应计划任务;Linux 上是 systemd(用户或系统级以安装器选择为准)。
不要再手写一份可能过时的 unit 去覆盖,除非 daemon status 明确失败且你知道自己在做什么。
4. Doctor 与 health
openclaw doctor
openclaw doctor --fix # 应用推荐修复
openclaw doctor --deep # 扫描系统里多余的 gateway 安装
openclaw health # 向正在跑的 gateway 拉健康信息
我在这篇里没有贴一份「全绿」的 doctor 输出——因为本机只完成了 CLI 安装,没有走完带 API Key 的 onboard。
你配完之后,这俩命令应是第一反应,而不是先改配置文件。
5. Channels
openclaw channels --help
常用:
openclaw channels list
openclaw channels status
openclaw channels status --deep
openclaw channels add
openclaw channels logs
Telegram 接入时该守的底线
CLI 负责「通道对象」,Bot 仍要你在 Telegram 侧创建。流程可以概括成:
- BotFather 建 bot → 拿到 token
openclaw channels add或configure/onboard写入通道- 限制谁能聊:只放行你的 user id(旧稿里的
allowed_users思路仍对;具体字段以当前 configure 向导为准) openclaw channels status/channels logs看是否在收消息- 需要时
openclaw daemon restart或gateway重载
安全:
- token 进环境变量或 OpenClaw 状态目录,不进公开仓库
- Gateway 默认 bind 优先
loopback;对公网暴露前先搞懂 auth - 群组场景权限比私聊更难管,先私聊跑通
我没有在本机完成一次真实 Bot 联调(缺 token 与交互 onboard),所以 没有写「截图证明已连通」。你若联调失败,优先:
openclaw doctor
openclaw channels status --deep
openclaw channels logs
而不是重装整个 Node。
6. 和旧站长文的差异
| 旧通稿常见写法 | 2026.7.1-2 更贴切的做法 |
|---|---|
手写 systemd unit + ExecStart=openclaw gateway |
优先 daemon install / onboard --install-daemon |
只改一份 config.yaml 示例 |
用 configure / config 子命令,减少抄错字段 |
| 大而全渠道对比 | 先 channels add 一个 Telegram,再谈 Discord |
| 「效率提升 3 倍」 | 不写;能 health 绿、手机能回,就算阶段成功 |
7. 最小验收清单
装完并 onboard 后,建议你自己勾:
-
openclaw --version有版本号 -
openclaw daemon status显示服务在、能探测 -
openclaw doctor无致命项(或已--fix) -
openclaw channels status里目标通道为已连接/可用 - 私聊 bot 或
openclaw chat能完成一轮问答
相关
- 安装笔记(本机实装 2026.7.1-2)
- 上游 CLI 说明:
https://docs.openclaw.ai/cli/gateway(help 文末引用)
