diff --git a/README.md b/README.md index a38d00c..c91ec8d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Claw -云主机管理工具,命令行搞定 SSH 连接、脚本执行、文件分发。 +云主机管理工具,命令行搞定 SSH 连接、脚本执行。 ## 目录结构 @@ -8,10 +8,9 @@ Claw/ ├── claw.bat # 入口 (PowerShell 包装器) ├── claw.ps1 # 主控脚本 -├── hosts/ # 主机描述文件 +├── hosts/ # 主机描述文件 (.yml) ├── keys/ # SSH 私钥 (.pem) -├── scripts/ # 可执行脚本 -└── payloads/ # 待分发文件 +└── scripts/ # 可执行脚本 (.sh) ``` ## 命令 @@ -20,7 +19,6 @@ Claw/ claw list # 列出所有主机 claw ssh <主机名> # SSH 连接 claw run <主机名> <脚本名> # 执行脚本 -claw push <主机名> <文件或目录> # 推送文件到 /tmp/ claw key add <名称> # 注册密钥 claw key list # 列出密钥 ``` @@ -30,19 +28,21 @@ claw key list # 列出密钥 ### hosts/ — 主机描述 ``` -<主机标识>-<操作系统>-<用户名> +<主机标识>-<操作系统>-<用户名>.yml ``` -例:`tx-ubuntu-ubuntu` = 腾讯云主机 · Ubuntu · ubuntu 用户 +例:`tx-ubuntu-ubuntu.yml` = 腾讯云主机 · Ubuntu · ubuntu 用户 同一台机器的不同用户用独立文件: ``` -tx-ubuntu-ubuntu # → 62.234.90.54 用户 ubuntu -tx-ubuntu-hugo # → 62.234.90.54 用户 hugo +tx-ubuntu-ubuntu.yml # → 62.234.90.54 用户 ubuntu +tx-ubuntu-hugo.yml # → 62.234.90.54 用户 hugo +tx-ubuntu-cmcc.yml # → 62.234.90.54 用户 cmcc +tx-ubuntu-git.yml # → 62.234.90.54 用户 git ``` -YAML 格式(.yml 后缀),新建主机复制下面模板改: +YAML 格式,新建主机复制下面模板改: ```yaml # ╔══════════════════════════════════════════════════╗ @@ -53,7 +53,7 @@ host: ip: 1.2.3.4 user: root port: 22 - key: keys/example.pem + key: keys/example-ubuntu-root.pem info: name: example-server @@ -90,16 +90,15 @@ billing: ### keys/ — 密钥 +与 hosts 文件名一一对应: + ``` -<主机名>.pem +tx-ubuntu-ubuntu.pem +tx-ubuntu-hugo.pem +tx-ubuntu-cmcc.pem +tx-ubuntu-git.pem ``` -例:`tx-ubuntu.pem`、`tx-ubuntu-hugo.pem` - -### payloads/ — 发射区 - -把要发上主机的文件或目录扔进来,`claw push` 会走 SCP 发到主机的 `/tmp/` 下。 - ## 快速开始 ```cmd @@ -112,7 +111,6 @@ notepad hosts\my-host-ubuntu-root.yml # 3. 开工 claw ssh my-host-ubuntu-root claw run my-host-ubuntu-root sysinfo@my-host-ubuntu-root.sh -claw push my-host-ubuntu-root my-project ``` ## 全局命令 diff --git a/claw.ps1 b/claw.ps1 index 9e6e4bf..fc3ff4d 100644 --- a/claw.ps1 +++ b/claw.ps1 @@ -15,7 +15,6 @@ Commands: list List all hosts ssh SSH into a host run