守护进程
openclaw daemon 的 CLI 参考(Gateway 网关服务管理的旧版别名)
Gateway 网关服务管理的旧版别名。openclaw daemon ... 映射到与 openclaw gateway ... 相同的服务控制命令。当前文档和示例请优先参阅 openclaw gateway。
用法
openclaw daemon status
openclaw daemon install
openclaw daemon start
openclaw daemon stop
openclaw daemon restart
openclaw daemon uninstall子命令和选项
| 子命令 | 选项 |
|---|---|
status | --url, --token, --password, --timeout, --no-probe, --require-rpc, --deep, --json |
install | --port, --runtime <node>, --token, --wrapper <path>, --force, --json |
uninstall | --json |
start | --json |
stop | --json, --disable(仅限 launchd:在下次启动前持续禁止 KeepAlive/RunAtLoad) |
restart | --force, --safe, --skip-deferral, --wait <duration>, --json |
status:显示服务安装状态(launchd/systemd/schtasks)并探测 Gateway 健康。install:安装服务;--force会重新安装或覆盖现有安装。restart --safe:请求正在运行的 Gateway 网关预检当前活动任务,并在任务全部完成后安排一次合并重启,最长等待 5 分钟。超过此时间限制后,仍会强制重启。普通的restart直接使用服务管理器;--force是立即执行的覆盖选项。restart --safe --skip-deferral:绕过活动任务延迟门控,因此即使报告了阻塞项,Gateway 网关也会立即重启。需要--safe。
说明
status会尽可能解析已配置的身份验证 SecretRef,以用于探测身份验证。如果所需的 SecretRef 未解析,status --json会报告rpc.authWarning;请显式传入--token/--password,或先解析密钥来源。一旦探测在其他方面成功,就会抑制未解析身份验证警告。status --deep会额外执行尽力而为的系统级扫描,以查找其他类似 Gateway 网关的服务(输出清理提示;仍建议每台机器仅运行一个 Gateway 网关),并以插件感知模式运行配置验证,显示快速默认路径会跳过的插件清单警告。- 在 Linux systemd 安装中,令牌漂移检查会检查
Environment=和EnvironmentFile=这两个单元来源。 - 令牌漂移检查使用合并后的运行时环境解析
gateway.auth.tokenSecretRef(先使用服务命令环境,再使用进程环境)。如果令牌身份验证实际上未启用(password/none/trusted-proxy的gateway.auth.mode,或未设置且密码可以优先),则跳过配置令牌解析。 install会验证由 SecretRef 管理的gateway.auth.token是否可解析,但绝不会将解析后的值持久化到服务环境元数据中;如果无法解析,安装将以关闭方式失败。- 如果同时配置了
gateway.auth.token和gateway.auth.password,但未设置gateway.auth.mode,则install会阻止继续执行,直到你显式设置模式。 - 在 macOS 上,
install会将 LaunchAgent plist 和生成的环境文件/包装器设为仅所有者可访问(模式0600/0700),而不是将密钥嵌入EnvironmentVariables。 - 在一台主机上运行多个 Gateway 网关:请隔离端口、配置/状态和工作区。请参阅多个 Gateway 网关。