openclaw daemon

openclaw daemon 是 Gateway 服务管理命令的遗留别名,与 openclaw gateway 服务子命令等价。新脚本建议直接使用 openclaw gateway。

用法

openclaw daemon status
openclaw daemon install
openclaw daemon start
openclaw daemon stop
openclaw daemon restart
openclaw daemon uninstall

子命令说明

子命令说明
status显示服务安装状态并探测 Gateway 健康
install安装系统服务(launchd / systemd / schtasks)
uninstall卸载服务
start启动服务
stop停止服务
restart重启服务

常用选项

  • status:--url、--token、--password、--timeout、--no-probe、--require-rpc、--deep、--json
  • install:--port、--runtime <node|bun>、--token、--force、--json
  • restart:--safe、--skip-deferral、--force、--wait <duration>、--json

关键行为

  • status --deep:扫描系统级服务,检测多余的 gateway 实例,并在插件感知模式下做配置校验
  • restart --safe:等待活跃任务(reply delivery、embedded runs、task runs)排空后再重启
  • restart --safe --skip-deferral:强制立即重启,绕过排空等待(卡住任务时的逃生通道)
  • SecretRef 管理的 token 在 install 时只做可解析性校验,不会将明文 token 写入服务环境

macOS 注意

若曾用 launchctl setenv 设置过 OPENCLAW_GATEWAY_TOKEN,该值会覆盖配置文件,导致持续 “unauthorized” 错误:

launchctl unsetenv OPENCLAW_GATEWAY_TOKEN

相关链接