OpenClaw日常维护命令
根据 OpenClaw 官方文档整体的常用维护命令参考
·
OpenClaw 日常维护常用命令和参数说明
网关管理
启动网关
# 前台运行
openclaw gateway
# 前台运行(显式)
openclaw gateway run
常用参数:
| 参数 | 说明 | 默认值 |
|---|---|---|
--port <端口> |
WebSocket端口 | 18789 |
--bind <模式> |
绑定模式 | loopback/lan/tailnet/auto |
--auth <模式> |
认证模式 | token/password |
--token <令牌> |
指定认证令牌 | - |
--password <密码> |
指定认证密码 | - |
--allow-unconfigured |
允许未配置时启动 | - |
--dev |
创建开发配置 | - |
--force |
强制启动(杀掉占用端口的进程) | - |
--verbose |
详细日志 | - |
示例:
# 指定端口启动
openclaw gateway --port 19000
# 开发模式启动
openclaw gateway --dev
# 强制启动
openclaw gateway --force
服务管理
# 安装网关服务
openclaw gateway install
# 启动服务
openclaw gateway start
# 停止服务
openclaw gateway stop
# 重启服务
openclaw gateway restart
# 卸载服务
openclaw gateway uninstall
# 查看服务状态
openclaw gateway status
状态查看:
# 查看状态(JSON格式)
openclaw gateway status --json
# 深度检查(包含系统服务)
openclaw gateway status --deep
网关发现
# 扫描局域网内的网关
openclaw gateway discover
# 指定超时时间
openclaw gateway discover --timeout 4000
# JSON格式输出
openclaw gateway discover --json
网关健康检查
# 检查网关健康状态
openclaw gateway health --url ws://127.0.0.1:18789
配置管理
查看配置
# 查看配置文件路径
openclaw config file
# 获取指定配置项
openclaw config get agents.defaults.workspace
openclaw config get agents.list[0].id
openclaw config get gateway.port
# 查看整个配置
openclaw config get
修改配置
# 设置配置项
openclaw config set browser.executablePath "/usr/bin/google-chrome"
openclaw config set agents.defaults.heartbeat.every "2h"
openclaw config set gateway.port 19001
# 严格JSON解析
openclaw config set gateway.port 19001 --strict-json
# 删除配置项
openclaw config unset tools.web.search.apiKey
注意: 修改配置后需要重启网关才能生效。
验证配置
# 验证配置文件
openclaw config validate
openclaw config validate --json
交互式配置
# 打开配置向导
openclaw configure
# 指定配置部分
openclaw configure --section model
openclaw configure --section channels
模型管理
查看模型状态
# 查看当前模型状态
openclaw models status
# JSON格式
openclaw models status --json
# 纯文本格式
openclaw models status --plain
# 实时探测认证状态
openclaw models status --probe
列出模型
# 列出可用模型
openclaw models list
# 扫描可用模型
openclaw models scan
设置默认模型
# 设置默认模型
openclaw models set deepseek/deepseek-chat
openclaw models set qwen-turbo
模型别名
# 查看别名列表
openclaw models aliases list
# 查看回退模型列表
openclaw models fallbacks list
认证管理
# 添加认证
openclaw models auth add
# 登录提供商
openclaw models auth login --provider <提供商ID>
# 设置Token
openclaw models auth setup-token
openclaw models auth paste-token
状态与诊断
系统状态
# 查看完整状态
openclaw status
# 查看所有状态
openclaw status --all
# 深度检查(运行实时探测)
openclaw status --deep
# 查看使用统计
openclaw status --usage
Doctor 诊断
# 运行诊断
openclaw doctor
# 自动修复问题
openclaw doctor --repair
# 深度诊断
openclaw doctor --deep
Doctor功能:
- 检查网关和频道的健康状态
- 自动修复常见配置问题
- 检测孤立的会话文件
- 检查内存搜索就绪状态
- 检测Docker可用性(当启用沙箱模式时)
macOS launchctl 环境变量问题
如果遇到认证错误,检查环境变量:
# 查看环境变量
launchctl getenv OPENCLAW_GATEWAY_TOKEN
launchctl getenv OPENCLAW_GATEWAY_PASSWORD
# 清除环境变量
launchctl unsetenv OPENCLAW_GATEWAY_TOKEN
launchctl unsetenv OPENCLAW_GATEWAY_PASSWORD
更新与升级
检查更新状态
# 查看更新状态
openclaw update status
openclaw update status --json
执行更新
# 更新到最新版本
openclaw update
# 切换到测试版
openclaw update --channel beta
# 切换到开发版
openclaw update --channel dev
# 预览更新(不执行)
openclaw update --dry-run
# 更新后不重启网关
openclaw update --no-restart
更新向导
# 交互式更新向导
openclaw update wizard
更新通道:
stable:最新稳定版beta:测试版dev:开发版
插件管理
查看插件
# 列出已安装插件
openclaw plugins list
安装插件
# 安装官方插件
openclaw plugins install @openclaw/feishu
# 从本地安装
openclaw plugins install ./extensions/feishu
日志查看
# 查看日志
openclaw logs
# 实时跟踪日志
openclaw logs --follow
# JSON格式
openclaw logs --json
# 限制行数
openclaw logs --limit 500
# 本地时间显示
openclaw logs --follow --local-time
常用命令速查表
| 功能 | 命令 |
|---|---|
| 启动网关 | openclaw gateway |
| 重启网关 | openclaw gateway restart |
| 查看状态 | openclaw status |
| 修改端口 | openclaw config set gateway.port 19001 |
| 修改模型 | openclaw models set <model> |
| 诊断问题 | openclaw doctor |
| 查看日志 | openclaw logs --follow |
| 更新版本 | openclaw update |
| 配置向导 | openclaw configure |
配置文件位置
- 主配置:
~/.openclaw/openclaw.json - 配置备份:
~/.openclaw/openclaw.json.bak - 日志目录:
~/.openclaw/logs/ - 会话目录:
~/.openclaw/sessions/
更多信息请参考:https://docs.openclaw.ai
更多推荐



所有评论(0)