@@ -36,6 +36,14 @@ Flags:
36
36
Use " mmh [command] --help" for more information about a command.
37
37
```
38
38
39
+ ** 部分命令被重命名为快捷命令方便操作(安装后自动软连接)**
40
+
41
+ - ` mmh go ` ==> ` mgo `
42
+ - ` mmh exec ` ==> ` mec `
43
+ - ` mmh cp ` ==> ` mcp `
44
+ - ` mmh server ` ==> ` mcs `
45
+ - ` mmh ctx ` ==> ` mcx `
46
+
39
47
### 配置文件
40
48
41
49
从 ` v1.3.0 ` 版本开始,支持多配置文件切换功能;安装完成后将会自动在 ` $HOME/.mmh ` 下创建样例配置,默认配置文件结构如下
@@ -52,16 +60,16 @@ Use "mmh [command] --help" for more information about a command.
52
60
主配置文件结构如下
53
61
54
62
``` 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
62
70
` ` `
63
71
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` 都可以访问这些服务器。**
65
73
66
74
# ### default.yaml
67
75
74
82
privatekey: /Users/mritd/.ssh/id_rsa
75
83
privatekey_password: ""
76
84
port: 22
77
- proxy: ""
78
- maxproxy: 5
85
+ server_alive_interval: 0s
79
86
servers:
80
87
- name: prod11
81
88
tags:
@@ -84,27 +91,26 @@ servers:
84
91
password: password
85
92
privatekey: ""
86
93
privatekey_password: ""
87
- server_alive_interval: 20s
88
94
address: 10.10.4.11
89
95
port: 22
90
96
proxy: prod12
97
+ server_alive_interval: 20s
91
98
- name: prod12
92
99
tags:
93
100
- prod
94
101
user: root
95
102
password: ""
96
103
privatekey: /Users/mritd/.ssh/id_rsa
97
104
privatekey_password: password
98
- server_alive_interval: 10s
99
105
address: 10.10.4.12
100
106
port: 22
101
107
proxy: ""
108
+ server_alive_interval: 10s
102
109
tags:
103
110
- prod
104
- - test
105
111
` ` `
106
112
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` 用于实现保持链接。
108
114
109
115
110
116
# ## 自动登录
@@ -204,5 +210,3 @@ Flags:
204
210
205
211
Use "ctx [command] --help" for more information about a command.
206
212
` ` `
207
-
208
- 同时又增加了 `context` 自动回退功能,即给定一个超时时间,当在给定的超时时间内无操作(不会强行断开任何命令),下次操作将会自动回退到指定的 `context`,具体请参考上文配置段
0 commit comments