OpenClaw 命令使用指南
本文档涵盖 OpenClaw 在 Ubuntu 24.04 服务器环境下的常用命令说明。
一、Gateway 服务管理
1.1 查看状态
openclaw gateway status
1.2 启动 / 停止 / 重启
supervisorctl start openclaw-gateway 启动
supervisorctl stop openclaw-gateway 停止
supervisorctl restart openclaw-gateway 重启
1.3 查看运行状态
supervisorctl status openclaw-gateway
二、OpenClaw 更新与版本
2.1 查看当前版本
openclaw --version
2.2 检查并升级
openclaw update
当前最新版:2026.3.23-2,npm 上无更新则无需升级。
三、设备配对管理
3.1 查看已配对设备
openclaw devices list
3.2 查看待审批配对请求
openclaw devices list
输出中 Pending(待审批)部分即为新的配对申请。
3.3 批准设备配对
openclaw devices approve request-id
示例:openclaw devices approve 0f764b5d-cb33-4272-a4d0-fa18366113c3
3.4 拒绝配对请求
openclaw devices reject request-id
3.5 移除已配对设备
openclaw devices remove device-id
四、日志查看
4.1 实时监控 Gateway 日志
tail -f /tmp/openclaw/openclaw-YYYY-MM-DD.log
按 Ctrl+C 停止监控。
4.2 搜索特定内容
grep -i 关键词 /tmp/openclaw/openclaw-2026-03-25.log
五、后台运行说明
5.1 前台运行 vs 后台运行
前台运行:进程挂在终端,关闭终端会导致进程退出。
后台运行:进程独立运行,SSH 断开不受影响。
5.2 当前环境说明
OpenClaw 已通过 supervisor 实现后台运行:
服务进程:openclaw-gateway(由 supervisor 管理)
配置文件:/etc/supervisor/conf.d/openclaw.conf
日志路径:/var/log/openclaw-gateway.out.log
5.3 supervisor 管理命令汇总
supervisorctl status openclaw-gateway 查看状态
supervisorctl start openclaw-gateway 启动
supervisorctl stop openclaw-gateway 停止
supervisorctl restart openclaw-gateway 重启
supervisorctl reread 重读配置
supervisorctl update 更新配置
六、常见问题
Q1:Chrome/Edge 连接显示 1006 或 pairing required?
原因:nginx 的 HTTP/2 不支持 WebSocket 传统 Upgrade。
解决:去宝塔面板关闭网站的 HTTP/2,或手动审批设备配对。
Q2:Edge 始终无法连接?
原因:Edge 使用 HTTP/2 协议,WebSocket 握手被 nginx 拦截。
解决:同上,关闭 HTTP/2 或对 Edge 进行设备配对。
Q3:openclaw gateway restart 无效?
原因:环境缺少 systemd 用户服务。
解决:使用 supervisorctl restart openclaw-gateway 代替。
Q4:如何彻底卸载 supervisor 管理?
supervisorctl stop openclaw-gateway
supervisorctl remove openclaw-gateway
rm /etc/supervisor/conf.d/openclaw.conf
七、快速参考
openclaw --version 查看版本
supervisorctl restart openclaw-gateway 重启 gateway
openclaw devices list 查看配对设备
openclaw devices approve request-id 批准新设备配对
tail -f /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log 实时查看日志
openclaw update 更新 OpenClaw

发表回复