我不确定我现在是否有能力对此进行测试,但想知道是否有人可以建议是否可以做这样的事情:
Run a shell script
Shell Script SSH's into a machine (Connection requires SSH key only)
Stuff is run on that machine
Script run on that machine SSH's into another machine (Connection requires SSH key and password)
Stuff is run in that machine
Exit from that machine
Stuff is run in that machine
Exit from that machine
More stuff happens for a few hours
Run Code Online (Sandbox Code Playgroud)
想必这只是组装所需级别的脚本并让它运行的情况?借用另一个 SoF 问题的例子:
sshScript='
ls -la
sshScript2=`
ls -la
`
ssh -t ${UserName}@server "${sshScript2}"
ls -la …
Run Code Online (Sandbox Code Playgroud) ssh ×1