【发布时间】:2016-10-12 10:16:02
【问题描述】:
我必须远程连接到网关(在 Linux 平台上工作),其中有几个可执行文件(signingModule.sh 和 taxModule.sh)。 现在我想在我的桌面上编写一个脚本,它将连接到该网关并在两个不同的终端中运行 signingModule.sh 和 taxModule.sh。
我写了以下代码:
ssh root@10.138.77.150 #to connect to gateway
sleep 5
cd /opt/swfiscal/signingModule #path of both modules
./signingModule #executable.
但是通过这段代码我可以连接我的网关,但是连接到网关之后什么都没有发生。
第二个代码:
source configPath # file where i have given path of both the modules
cd $FCM_SCRIPTS # variable in which i have stored the path of modules
ssh root@10.138.77.150 'sh -' < startSigningModule** #to connect and run one module.
作为我得到的输出:
-source: configPath: 找不到文件
请帮我解决这个问题。提前致谢。
注意事项:
- 如果需要,我可以将我的文件复制粘贴到该网关中。
-
Gnome-Terminal或任何其他替代方法在我的网关中不起作用
【问题讨论】:
-
你可以这样做。 ssh bar@foo "command1 && command2"
-
它不工作:(
-
你有什么错误吗?
-
no..看到进入那个网关我必须给一个密码..所以一旦我在运行这个之后给出那个密码:ssh root@10.138.77.150 "cd / opt/swfiscal/signingModule && ./signingModule",那么什么都没有发生
-
这很奇怪。检查至少此命令是否适合您。 ssh root@10.138.77.150 "cd /opt && ls"
标签: linux bash shell ubuntu remote-access