feat: add macOS LaunchAgent install/uninstall scripts

- Add install-launchagent.sh for auto-start on boot
- Add uninstall-launchagent.sh for service removal
- Update README.md with deployment instructions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hotwa
2026-03-22 16:02:40 +08:00
parent 829682b98a
commit ebd73e1c69
3 changed files with 206 additions and 0 deletions

View File

@@ -78,3 +78,65 @@ curl -s http://127.0.0.1:11435/api/chat \
npm run test
\`\`\`
将会进行 `xml-toolcall` 解析用例和端到端整合测试。
---
## macOS 开机自启动部署
本项目提供了 LaunchAgent 安装脚本,可将代理服务配置为开机自动启动。
### 安装步骤
1. 确保已完成前面的「获取代码与安装」和「环境配置」步骤
2. 运行安装脚本:
\`\`\`bash
./install-launchagent.sh
\`\`\`
3. 验证服务状态:
\`\`\`bash
# 检查服务是否运行
launchctl list com.openclaw.ollama-proxy
# 测试代理响应
curl http://127.0.0.1:11435/
\`\`\`
### 常用命令
| 操作 | 命令 |
|------|------|
| 查看状态 | `launchctl list com.openclaw.ollama-proxy` |
| 停止服务 | `launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/com.openclaw.ollama-proxy.plist` |
| 启动服务 | `launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.openclaw.ollama-proxy.plist` |
| 查看日志 | `tail -f ~/Library/Logs/OpenClawOllamaProxy/stdout.log` |
| 查看错误日志 | `tail -f ~/Library/Logs/OpenClawOllamaProxy/stderr.log` |
### 卸载服务
\`\`\`bash
./uninstall-launchagent.sh
\`\`\`
### 多机器部署
如需在多台机器上部署,只需在每台机器上执行以下步骤:
\`\`\`bash
# 1. 克隆代码
git clone ssh://git@gitea.jmsu.top:2222/lingyuzeng/openclaw-ollama-toolcall-proxy.git
cd openclaw-ollama-toolcall-proxy
# 2. 安装依赖
npm install
# 3. 配置环境变量
cp .env.example .env
# 编辑 .env 配置目标 Ollama 地址
# 4. 安装开机自启动服务
./install-launchagent.sh
\`\`\`
日志位置:`~/Library/Logs/OpenClawOllamaProxy/`