星辉: 整理TOOLS模板紧凑格式 2026-04-04
This commit is contained in:
@@ -11,8 +11,6 @@
|
||||
|
||||
- **权限原则**: 遵循最小权限原则
|
||||
|
||||
|
||||
|
||||
## 2.管理流程
|
||||
|
||||
1. 所有服务器操作都通过SSH进行
|
||||
@@ -23,51 +21,34 @@
|
||||
|
||||
4. 保持所有服务器的管理方式一致
|
||||
|
||||
|
||||
|
||||
|
||||
## 3.文件编辑注意事项
|
||||
|
||||
- **所有重要文件**: 使用 `exec + echo` 追加内容,避免 edit 工具在文件末尾无换行时失败
|
||||
|
||||
- **edit工具使用准则**: edit依赖精确文本匹配,任何空白字符差异都会导致失败。建议:先 read 文件确认内容,用 write 重写整个文件更可靠(特别是 memory、SOUL、IDENTITY 等重要文件)
|
||||
|
||||
|
||||
|
||||
## 4.FRP (frpc 客户端) 管理
|
||||
|
||||
### 安装目录
|
||||
|
||||
|
||||
|
||||
| 服务器 | FRP目录 |
|
||||
| ------- | --------------------------------- |
|
||||
| macmini | /opt/frp/frp_0.65.0_darwin_arm64 |
|
||||
| ubuntu1 | /opt/frp/frp_0.65.0_linux_amd64 |
|
||||
| ubuntu2 | /opt/frp/frp_0.65.0_linux_amd64 |
|
||||
|
||||
|
||||
|
||||
### 配置文件
|
||||
|
||||
- **文件名**: `frpc.toml`(在FRP目录下)
|
||||
|
||||
- **作用**: 定义所有通过frp反向代理的应用及端口映射 (localPort ↔ remotePort)
|
||||
|
||||
|
||||
|
||||
### Mac Mini 管理方式(launchd)
|
||||
|
||||
|
||||
|
||||
**启动方式**: launchd plist(`KeepAlive: true`,崩溃自动重启)
|
||||
|
||||
|
||||
|
||||
**plist 位置**: `~/Library/LaunchAgents/com.homebrew.frpc.plist`
|
||||
|
||||
|
||||
|
||||
**管理命令**:
|
||||
|
||||
```bash
|
||||
@@ -76,32 +57,22 @@
|
||||
|
||||
launchctl unload ~/Library/LaunchAgents/com.homebrew.frpc.plist && launchctl load ~/Library/LaunchAgents/com.homebrew.frpc.plist
|
||||
|
||||
|
||||
|
||||
# 停止(KeepAlive 会自动重启,需先 unload)
|
||||
|
||||
launchctl unload ~/Library/LaunchAgents/com.homebrew.frpc.plist
|
||||
|
||||
|
||||
|
||||
# 查看状态
|
||||
|
||||
launchctl list | grep frpc
|
||||
|
||||
|
||||
|
||||
# 查看日志
|
||||
|
||||
tail -f /opt/frp/frp_0.65.0_darwin_arm64/frpc.log
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
**正常状态标志**: 日志中显示 `[name] start proxy success`
|
||||
|
||||
|
||||
|
||||
### Ubuntu1/2 管理方式(systemd --user)
|
||||
|
||||
```bash
|
||||
@@ -118,8 +89,6 @@ ssh ubuntu2 'systemctl --user status frpc'
|
||||
|
||||
不需要密码,开机自启(linger 已启用)
|
||||
|
||||
|
||||
|
||||
### 查看配置
|
||||
|
||||
```bash
|
||||
@@ -130,12 +99,8 @@ cat /opt/frp/frp_0.65.0_xxx/frpc.toml
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 5.FRP端口映射查询格式 (2026-03-14)
|
||||
|
||||
|
||||
|
||||
用户会这样提问:
|
||||
|
||||
- "ubuntu1上frp的列表"
|
||||
@@ -148,12 +113,8 @@ cat /opt/frp/frp_0.65.0_xxx/frpc.toml
|
||||
|
||||
输出格式: 表格 (名称 | 类型 | localPort | remotePort)
|
||||
|
||||
|
||||
|
||||
查询示例: ssh到对应服务器 -> cat /opt/frp/frp_0.65.0_xxx/frpc.toml
|
||||
|
||||
|
||||
|
||||
## 6.FRP状态检查 (2026-04-04)
|
||||
|
||||
用户可能说: "检查frp状态"
|
||||
@@ -170,16 +131,12 @@ cat /opt/frp/frp_0.65.0_xxx/frpc.toml
|
||||
|
||||
- `systemctl --user status frpc`
|
||||
|
||||
|
||||
|
||||
**正常状态标志**:
|
||||
|
||||
- 所有 proxy 启动成功时会显示: `[xxx] [name] start proxy success`
|
||||
|
||||
- 例如: `2026-04-04 16:43:01.276 [I] [client/control.go:172] [1a254958e6553119] [macmini-ssh] start proxy success`
|
||||
|
||||
|
||||
|
||||
**重启命令** (如果需要):
|
||||
|
||||
1. 如果是macmini服务器:
|
||||
@@ -198,8 +155,6 @@ systemctl --user restart frpc
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 7.VPS2 (x-UI 科学上网)
|
||||
|
||||
- **IP**: 104.194.92.188
|
||||
@@ -212,9 +167,6 @@ systemctl --user restart frpc
|
||||
|
||||
- 结果展示用列表方式,方便阅读
|
||||
|
||||
|
||||
|
||||
|
||||
## 8.网络测试策略 (2026-03-15)
|
||||
|
||||
用户可能说: "网络测试"、"检查服务器科学上网"
|
||||
@@ -227,8 +179,6 @@ systemctl --user restart frpc
|
||||
|
||||
3. 国外通过代理访问 Google (socks5://127.0.0.1:10808)
|
||||
|
||||
|
||||
|
||||
**测试命令模板**:
|
||||
|
||||
**国内访问直连**
|
||||
@@ -239,8 +189,6 @@ curl -v https://www.baidu.com
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
**国外访问直连**
|
||||
|
||||
```
|
||||
@@ -249,8 +197,6 @@ curl -v https://www.google.com
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
**国外访问通过代理连**
|
||||
|
||||
这是最快、最直接的方法。我们可以强制 `curl` 使用 SOCKS5 代理去访问 Google 的状态页。
|
||||
@@ -275,12 +221,8 @@ curl -x socks5h://127.0.0.1:10808 -v https://www.google.com
|
||||
|
||||
- 如果显示 `Connection refused` 或 `Timeout`,说明**端口未开放或 V2Ray 未运行**。
|
||||
|
||||
|
||||
|
||||
**服务器列表与代理端口**:
|
||||
|
||||
|
||||
|
||||
| 服务器 | IP | 代理端口 | 备注 |
|
||||
|
||||
|--------|-----|---------|------|
|
||||
@@ -297,12 +239,8 @@ curl -x socks5h://127.0.0.1:10808 -v https://www.google.com
|
||||
|
||||
| VPS2 | 104.194.92.188 | - | 直连正常 |
|
||||
|
||||
|
||||
|
||||
**输出格式**: 列表方式,方便阅读
|
||||
|
||||
|
||||
|
||||
**网络测试输出格式**
|
||||
|
||||
用户要求格式示例:
|
||||
@@ -315,12 +253,8 @@ curl -x socks5h://127.0.0.1:10808 -v https://www.google.com
|
||||
|
||||
• 国外访问通过代理XXX连: ✅/❌
|
||||
|
||||
|
||||
|
||||
## 9.OpenClaw 命令路径 (2026-03-27)
|
||||
|
||||
|
||||
|
||||
| 服务器 | OpenClaw 路径 |
|
||||
|
||||
| -------- | ---------------------------------------- |
|
||||
@@ -331,8 +265,6 @@ curl -x socks5h://127.0.0.1:10808 -v https://www.google.com
|
||||
|
||||
| Ubuntu2 | `/home/shenwei/.npm-global/bin/openclaw` |
|
||||
|
||||
|
||||
|
||||
## 10.NAS Docker 代理配置 (2026-03-27)
|
||||
|
||||
- **配置文件**: `/etc/systemd/system/pkg-ContainerManager-dockerd.service.d/http-proxy.conf`
|
||||
@@ -341,8 +273,6 @@ curl -x socks5h://127.0.0.1:10808 -v https://www.google.com
|
||||
|
||||
- **修改后需执行**: `sudo systemctl daemon-reload && sudo systemctl restart docker`
|
||||
|
||||
|
||||
|
||||
## 11.sag (TTS 语音生成) (2026-03-27)
|
||||
|
||||
### 安装
|
||||
@@ -353,8 +283,6 @@ brew install steipete/tap/sag
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### API Key 配置
|
||||
|
||||
- 位置: `~/.openclaw/.env`
|
||||
@@ -371,8 +299,6 @@ source ~/.openclaw/.env
|
||||
|
||||
sag --api-key "$ELEVENLABS_API_KEY" -o /tmp/voice.mp3 "要转换的文字"
|
||||
|
||||
|
||||
|
||||
# 2. 发送到 Telegram (voice note)
|
||||
|
||||
message --account <telegram bot> --chatId <user_id> --filePath /tmp/voice.mp3 --message "文字" --buttons []
|
||||
@@ -387,8 +313,6 @@ message --account <telegram bot> --chatId <user_id> --filePath /tmp/voice.mp3 --
|
||||
|
||||
- 文件临时保存在 /tmp/ 目录
|
||||
|
||||
|
||||
|
||||
### OpenCode
|
||||
|
||||
- **路径**: `/Users/weishen/.opencode/bin/opencode`
|
||||
@@ -397,28 +321,18 @@ message --account <telegram bot> --chatId <user_id> --filePath /tmp/voice.mp3 --
|
||||
|
||||
- **用法**: 开发任务必须通过它执行
|
||||
|
||||
|
||||
|
||||
|
||||
## 12.OpenClaw Gateway 重启步骤
|
||||
|
||||
|
||||
|
||||
### Mac Mini (2026-03-30 新方法)
|
||||
|
||||
使用 `launchctl` 管理 OpenClaw Gateway 服务:
|
||||
|
||||
`launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist && launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist`
|
||||
|
||||
|
||||
|
||||
|
||||
### Ubuntu1/2 服务器 (2026-03-28)
|
||||
|
||||
#### 完整操作流程
|
||||
|
||||
|
||||
|
||||
**1. SSH 登录并重启**
|
||||
|
||||
```bash
|
||||
@@ -429,8 +343,6 @@ ssh ubuntu2 'systemctl --user restart openclaw-gateway'
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
**2. 查看启动状态**
|
||||
|
||||
```bash
|
||||
@@ -441,8 +353,6 @@ ssh ubuntu2 'systemctl --user status openclaw-gateway'
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
**3. 检查 OpenClaw 健康状态**
|
||||
|
||||
```bash
|
||||
@@ -453,8 +363,6 @@ ssh ubuntu2 '/home/shenwei/.npm-global/bin/openclaw status'
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 快捷命令组合 (单行执行)
|
||||
|
||||
```bash
|
||||
@@ -463,20 +371,14 @@ ssh ubuntu2 '/home/shenwei/.npm-global/bin/openclaw status'
|
||||
|
||||
ssh ubuntu1 'systemctl --user restart openclaw-gateway && systemctl --user status openclaw-gateway && /home/shenwei/.npm-global/bin/openclaw status'
|
||||
|
||||
|
||||
|
||||
# Ubuntu2
|
||||
|
||||
ssh ubuntu2 'systemctl --user restart openclaw-gateway && systemctl --user status openclaw-gateway && /home/shenwei/.npm-global/bin/openclaw status'
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 13.AgentMail (邮件收发与自动化) (2026-04-04 更新)
|
||||
|
||||
|
||||
|
||||
### 📂 技能目录
|
||||
|
||||
```
|
||||
@@ -501,12 +403,8 @@ ssh ubuntu2 'systemctl --user restart openclaw-gateway && systemctl --user statu
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 快速使用
|
||||
|
||||
|
||||
|
||||
#### 查看收件箱
|
||||
|
||||
```bash
|
||||
@@ -517,8 +415,6 @@ python3 ~/.openclaw/skills/agentmail/scripts/check_inbox.py --inbox star-agent@a
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 发送邮件
|
||||
|
||||
```bash
|
||||
@@ -535,16 +431,12 @@ python3 ~/.openclaw/skills/agentmail/scripts/send_email.py \
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### API Key 配置
|
||||
|
||||
- 位置: `~/.openclaw/.env`
|
||||
|
||||
- 环境变量: `AGENTMAIL_API_KEY=your_key_here`
|
||||
|
||||
|
||||
|
||||
### 附件处理
|
||||
|
||||
附件需要用 Python 代码下载,参考:
|
||||
@@ -557,8 +449,6 @@ cat ~/.openclaw/skills/agentmail/references/EXAMPLES.md
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### ⚠️ 注意事项
|
||||
|
||||
- **代理问题**:遇到 SOCKS 代理错误时,先 `unset HTTP_PROXY && unset HTTPS_PROXY`
|
||||
@@ -567,9 +457,6 @@ cat ~/.openclaw/skills/agentmail/references/EXAMPLES.md
|
||||
|
||||
- **参考文档**:详细用法见 `references/API.md` 和 `references/EXAMPLES.md`
|
||||
|
||||
|
||||
|
||||
|
||||
## 14.Docker命令路径 (2026-04-04)
|
||||
|
||||
| 服务器 | 命令 | 说明 |
|
||||
@@ -582,8 +469,6 @@ cat ~/.openclaw/skills/agentmail/references/EXAMPLES.md
|
||||
|
||||
| ubuntu1/2 | `docker` | 直接可用 |
|
||||
|
||||
|
||||
|
||||
**使用方式**:
|
||||
|
||||
```bash
|
||||
@@ -592,14 +477,10 @@ cat ~/.openclaw/skills/agentmail/references/EXAMPLES.md
|
||||
|
||||
docker ps
|
||||
|
||||
|
||||
|
||||
# macmini SSH
|
||||
|
||||
ssh macmini '/Applications/Docker.app/Contents/Resources/bin/docker ps'
|
||||
|
||||
|
||||
|
||||
# ubuntu1/2 SSH
|
||||
|
||||
ssh ubuntu1 'docker ps'
|
||||
|
||||
Reference in New Issue
Block a user