openclaw daemon
管理 OpenClaw 后台守护进程的生命周期。守护进程负责维持 Agent 运行、渠道连接和定时任务调度。
命令签名
bash
openclaw daemon <子命令> [选项]子命令
| 子命令 | 说明 |
|---|---|
start | 启动守护进程 |
stop | 停止守护进程 |
status | 查看守护进程状态 |
restart | 重启守护进程 |
openclaw daemon start
在后台启动守护进程。
bash
openclaw daemon start [选项]| 选项 | 类型 | 说明 |
|---|---|---|
--foreground | boolean | 前台运行(不进入后台) |
--log-file <path> | string | 指定日志输出文件 |
--pid-file <path> | string | 指定 PID 文件路径 |
openclaw daemon stop
停止正在运行的守护进程。
bash
openclaw daemon stop [选项]| 选项 | 类型 | 说明 |
|---|---|---|
--force | boolean | 强制终止进程 |
--timeout <seconds> | number | 优雅关闭的超时时间(默认 30) |
openclaw daemon status
查看守护进程的当前运行状态。
bash
openclaw daemon status [--json]输出示例:
Daemon Status: running
PID: 12345
Uptime: 3h 45m
Log File: ~/.openclaw/logs/daemon.log
Agents: 2 running
Channels: 3 connected
Cron Jobs: 5 activeopenclaw daemon restart
重启守护进程(先停止后启动)。
bash
openclaw daemon restartPID 文件
守护进程启动后会在 ~/.openclaw/daemon.pid 写入进程 ID。此文件用于后续 stop、status 操作的进程追踪。
日志管理
默认日志输出到 ~/.openclaw/logs/daemon.log。可通过 --log-file 选项或配置文件修改路径。
示例
bash
# 启动守护进程
openclaw daemon start
# 前台运行(调试用)
openclaw daemon start --foreground
# 指定日志文件
openclaw daemon start --log-file /var/log/openclaw.log
# 查看状态
openclaw daemon status
# 重启
openclaw daemon restart
# 停止
openclaw daemon stop
# 强制终止
openclaw daemon stop --forceTIP
大多数 CLI 命令(如 openclaw acp、openclaw agent start)会在需要时自动启动守护进程。
另请参阅
openclaw gateway— 网关控制openclaw health— 健康检查openclaw agent— Agent 管理
