Skip to content

Commit 84829e4

Browse files
author
mritd
committed
docs(readme): update README.md
update README.md Signed-off-by: mritd <[email protected]>
1 parent 5c26a53 commit 84829e4

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

README.md

+20-16
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ Flags:
3636
Use "mmh [command] --help" for more information about a command.
3737
```
3838

39+
**部分命令被重命名为快捷命令方便操作(安装后自动软连接)**
40+
41+
- `mmh go` ==> `mgo`
42+
- `mmh exec` ==> `mec`
43+
- `mmh cp` ==> `mcp`
44+
- `mmh server` ==> `mcs`
45+
- `mmh ctx` ==> `mcx`
46+
3947
### 配置文件
4048

4149
`v1.3.0` 版本开始,支持多配置文件切换功能;安装完成后将会自动在 `$HOME/.mmh` 下创建样例配置,默认配置文件结构如下
@@ -52,16 +60,16 @@ Use "mmh [command] --help" for more information about a command.
5260
主配置文件结构如下
5361

5462
``` yaml
55-
context:
56-
default:
57-
config_path: ./default.yaml
58-
context_auto_downgrade: default
59-
context_timeout: 30m
60-
context_use: default
61-
context_use_time: 2018-12-02T19:50:44.681871+08:00
63+
basic: default
64+
contexts:
65+
- name: default
66+
config_path: ./default.yaml
67+
- name: dohko
68+
config_path: ./dohko.yaml
69+
current: dohko
6270
```
6371
64-
主配置文件中可以配置多个 `context`,由 `context_use` 字段指明当前使用哪个 `context`,**在每个 `context` 下执行完命令都会刷新 `context_use_time` 时间戳**;如果同时配置了 `context_timeout` 和 `context_auto_downgrade` 字段,**每次执行命令前都会检查上次使用时间距今是否超过了 `context_timeout`,如果超过则将会自动回退到 `context_auto_downgrade` 指定的 `context`**;这样可以避免长时间停留在某个重要的 `context` 上从而造成误操作(比如线上环境)
72+
主配置文件中可以配置多个 `context`,由 `current` 字段指明当前使用哪个 `context`, `basic` 设置的 `context` 会作为额外补充服务器加入 `current` 指明的 `context` 中;**`basic` 适用于存放一些常规服务器,比如个人的 vps 等,以保证在任何 `context` 都可以访问这些服务器。**
6573

6674
#### default.yaml
6775

@@ -74,8 +82,7 @@ basic:
7482
privatekey: /Users/mritd/.ssh/id_rsa
7583
privatekey_password: ""
7684
port: 22
77-
proxy: ""
78-
maxproxy: 5
85+
server_alive_interval: 0s
7986
servers:
8087
- name: prod11
8188
tags:
@@ -84,27 +91,26 @@ servers:
8491
password: password
8592
privatekey: ""
8693
privatekey_password: ""
87-
server_alive_interval: 20s
8894
address: 10.10.4.11
8995
port: 22
9096
proxy: prod12
97+
server_alive_interval: 20s
9198
- name: prod12
9299
tags:
93100
- prod
94101
user: root
95102
password: ""
96103
privatekey: /Users/mritd/.ssh/id_rsa
97104
privatekey_password: password
98-
server_alive_interval: 10s
99105
address: 10.10.4.12
100106
port: 22
101107
proxy: ""
108+
server_alive_interval: 10s
102109
tags:
103110
- prod
104-
- test
105111
```
106112

107-
`basic` 段为默认配置,用于在 `servers` 段中某项配置不存在时进行填充;`servers` 段中可以配置 N 多个服务器(`server`);每个 `server` 除了常规的 SSH 相关配置外还增加了 `proxy` 字段用于支持无限跳板(具体见下文);`tag` 字段必须存在于在下面的 `tags` 段中,该配置主要是为了给服务器打 `tag` 方便批量复制与执行;`maxproxy` 是一个数字,用于处理当出现配置错误导致 "真·无限跳板" 情况时自动断开链接
113+
`basic` 段为默认配置,用于在 `servers` 段中某项配置不存在时进行填充;`servers` 段中可以配置 N 多个服务器(`server`);每个 `server` 除了常规的 SSH 相关配置外还增加了 `proxy` 字段用于支持无限跳板(具体见下文);`tag` 字段必须存在于在下面的 `tags` 段中,该配置主要是为了给服务器打 `tag` 方便批量复制与执行;`maxproxy` 是一个数字,用于处理当出现配置错误导致 "真·无限跳板" 情况时自动断开链接;`server_alive_interval` 用于实现保持链接。
108114

109115

110116
### 自动登录
@@ -204,5 +210,3 @@ Flags:
204210
205211
Use "ctx [command] --help" for more information about a command.
206212
```
207-
208-
同时又增加了 `context` 自动回退功能,即给定一个超时时间,当在给定的超时时间内无操作(不会强行断开任何命令),下次操作将会自动回退到指定的 `context`,具体请参考上文配置段

0 commit comments

Comments
 (0)