Http 使用ssh连接在2个不同的服务器中添加1个具有htpasswd的用户
我正在使用apache camel,我想在两个不同的服务器中添加一个用户。我想测试ssh.redundancy=true。这是我的代码:Http 使用ssh连接在2个不同的服务器中添加1个具有htpasswd的用户,http,ssh,apache-camel,Http,Ssh,Apache Camel,我正在使用apache camel,我想在两个不同的服务器中添加一个用户。我想测试ssh.redundancy=true。这是我的代码: <simple ${headers.op} == 1</simple> <doTry id="try-cmd-httpd"> <setBody id="httpd.cmd.h
<simple ${headers.op} == 1</simple>
<doTry id="try-cmd-httpd">
<setBody id="httpd.cmd.htpasswd">
<simple>htpasswd -b /etc/httpd/passwords ${header.login} ${header.passwd} {{httpd.io_redir}}</simple>
</setBody>
**<to id="to_exec_htpaswd" uri="ssh://{{ssh.user}}:{{ssh.passwd}}@{{ssh.host}}:{{ssh.port}}"/>**
<log id="htpasswdResp_log" message="response: ${body}"/>
**<to id="to_exec_htpaswd2" uri="ssh://{{ssh.user}}:{{ssh.passwd}}@{{ssh.host2}}:{{ssh.port}}"/>**
<log id="htpasswdResp_log2" message="response: ${body}"/> ```
我找到了解决方案。只需为参数ssh.redundancy和invoque添加第二次选择
<when id="redundancytrue">
<simple>{{ssh.redundancy}} == "true"</simple>
<setBody id="httpd.cmd.htpasswd">
<simple>htpasswd -b /etc/httpd/passwords ${header.login} ${header.passwd} {{httpd.io_redir}}</simple>
</setBody>
<to id="to_exec_htpaswd2" uri="ssh://{{ssh.user}}:{{ssh.passwd}}@{{ssh.host2}}:{{ssh.port}}"/>
</when>
</choice>```
{{ssh.redundancy}}==“true”
htpasswd-b/etc/httpd/passwords${header.login}${header.passwd}{{httpd.io_redir}
```
我找到了解决方案。只需为参数ssh.redundancy和invoque添加一个选项,这是第二次
<when id="redundancytrue">
<simple>{{ssh.redundancy}} == "true"</simple>
<setBody id="httpd.cmd.htpasswd">
<simple>htpasswd -b /etc/httpd/passwords ${header.login} ${header.passwd} {{httpd.io_redir}}</simple>
</setBody>
<to id="to_exec_htpaswd2" uri="ssh://{{ssh.user}}:{{ssh.passwd}}@{{ssh.host2}}:{{ssh.port}}"/>
</when>
</choice>```
{{ssh.redundancy}}==“true”
htpasswd-b/etc/httpd/passwords${header.login}${header.passwd}{{httpd.io_redir}
```