复现已有算法
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
---
|
||||
name: edge-sync-host
|
||||
description: 边缘运行目录同步流程。用于用户说“同步到87主机”“同步到85主机”“把边缘包同步到某主机”等场景,默认执行 scripts/migrate_edge.sh,并把用户说出的数字主机作为 --dst_host;87 只是示例,其他数字主机同理。
|
||||
---
|
||||
|
||||
# 边缘运行目录同步
|
||||
|
||||
## 何时使用
|
||||
|
||||
- 同步到87主机
|
||||
- 同步到 85 主机
|
||||
- 把边缘包同步到某主机
|
||||
- 将 runtime/edge 部署到目标主机
|
||||
|
||||
## 固定规则
|
||||
|
||||
- 脚本:`scripts/migrate_edge.sh`
|
||||
- 默认源:82 主机的 `/home/cat/code/edge_collector/runtime/edge`
|
||||
- 默认目标目录:`/home/cat/edge`
|
||||
- 数字主机解析:`87` -> `192.168.40.87`
|
||||
- 默认用户:`cat`
|
||||
- 默认密码:`i7568737i`
|
||||
- 如果用户要求“在某台主机编译,再同步到同一台主机”,也必须使用 `scripts/migrate_edge.sh` 的同步方式;不要改成手写 `scp`、`rsync` 或本机 `cp`。
|
||||
- 同主机编译部署时,显式传入相同的源和目标主机,例如在 97 编译并同步到 97:
|
||||
|
||||
```bash
|
||||
bash scripts/migrate_edge.sh --src_host 97 --dst_host 97
|
||||
```
|
||||
|
||||
## 执行方式
|
||||
|
||||
用户说“同步到87主机”时,在本仓库根目录执行:
|
||||
|
||||
```bash
|
||||
bash scripts/migrate_edge.sh --dst_host 87
|
||||
```
|
||||
|
||||
同步完成后,必须在目标主机重启边缘服务并验证状态:
|
||||
|
||||
```bash
|
||||
sshpass -p 'i7568737i' ssh -o StrictHostKeyChecking=no cat@192.168.40.87 \
|
||||
'echo i7568737i | sudo -S systemctl restart edge && systemctl is-active edge'
|
||||
```
|
||||
|
||||
用户说其他数字主机时,把数字替换到 `--dst_host`:
|
||||
|
||||
```bash
|
||||
bash scripts/migrate_edge.sh --dst_host <host_number>
|
||||
```
|
||||
|
||||
随后也要把重启命令中的目标地址替换为 `192.168.40.<host_number>`,执行 `sudo systemctl restart edge` 并确认 `systemctl is-active edge` 返回 `active`。
|
||||
|
||||
用户说“在 97 编译,同步到 97”这类同主机编译部署时,应先在对应主机完成构建:
|
||||
|
||||
```bash
|
||||
sshpass -p 'i7568737i' ssh -o StrictHostKeyChecking=no cat@192.168.40.97 \
|
||||
'cd /home/cat/code/edge_collector && git pull && ./package.sh --edge-only'
|
||||
```
|
||||
|
||||
然后仍然通过迁移脚本同步,源和目标主机保持一致:
|
||||
|
||||
```bash
|
||||
bash scripts/migrate_edge.sh --src_host 97 --dst_host 97
|
||||
```
|
||||
|
||||
最后重启同一台目标主机的 `edge` 服务并验证状态。
|
||||
|
||||
## 注意
|
||||
|
||||
- 87 只是示例,不是固定目标。
|
||||
- 不要手写 scp/rsync 流程,优先使用 `scripts/migrate_edge.sh`。
|
||||
- 同步成功后必须重启目标主机的 `edge` 服务;不要只同步文件就结束。
|
||||
- 如果用户明确指定源主机、目标用户、目标目录或密码,以用户本次明确值为准,并透传给脚本参数。
|
||||
@@ -0,0 +1,3 @@
|
||||
display_name: 边缘同步主机
|
||||
short_description: 使用 migrate_edge.sh 同步 runtime/edge 并重启目标 edge 服务
|
||||
default_prompt: Use this skill when the user says "同步到87主机", "同步到85主机", or asks to sync the edge runtime package to a numbered host. Run bash scripts/migrate_edge.sh --dst_host <host_number> from the repo root. Treat 87 only as an example; other numbered hosts map to 192.168.40.<number>. After sync succeeds, SSH to cat@192.168.40.<host_number> with password i7568737i, run sudo systemctl restart edge, and verify systemctl is-active edge returns active. Prefer the script over hand-written scp or rsync commands.
|
||||
Reference in New Issue
Block a user