此代码在我的系统上打开三个窗口,并登录到三个不同的ec2实例。
(xterm -geometry 70x70-0-0 -e ssh -i key1 ec2-user@52.x.x.x;) &
(xterm -geometry 70x70+485-200 -e ssh -i key1 ec2-user@52.x.x.x;) &
(xterm -geometry 70x70+0-0 -e ssh -i key1 ec2-user@52.x.x.x;)
但是,我想登录这三个实例并在其中执行相应的命令。类似的东西:
(xterm -geometry 70x70-0-0 -e ssh -i key1 ec2-user@52.x.x.x; **run python file on this instance**) &
(xterm -geometry 70x70+485-200 -e ssh -i key1 ec2-user@52.x.x.x; **run node file on this instance**) &
(xterm -geometry 70x70+0-0 -e ssh -i key1 ec2-user@52.x.x.x; **run R file on this instance**)
答案 0 :(得分:1)
这样做:
(xterm -geometry 70x70-0-0 -e ssh -i key1 ec2-user@52.x.x.x -t "script.py ; bash";) &
-t
选项制作一个tty,bash
后script.py
你会得到一个交互式bash来继续指挥。
答案 1 :(得分:0)
要改变的主要方法是在" **运行之前摆脱分号" (以及使用真实的命令)。像
这样的东西 (xterm -geometry 70x70-0-0 -e ssh -i key1 ec2-user@52.x.x.x
**
在此实例上运行python文件**
) &
(xterm -geometry 70x70+485-200 -e ssh -i key1 ec2-user@52.x.x.x
**
在此实例上运行节点文件**
) &
(xterm -geometry 70x70+0-0 -e ssh -i key1 ec2-user@52.x.x.x
* **run R file on this instance***
) &
在选项(例如-i
)和登录信息之后,ssh
接受命令和参数。