我必须远程连接到网关(在 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: file not found
请帮我解决这个问题。提前致谢。
注意事项:
- 如果需要,我可以在该网关中复制粘贴我的文件。
Gnome-Terminal
或任何其他替代品在我的网关中不起作用
最佳答案
ssh root@10.138.77.150 "cd /opt/swfiscal/signingModule && ./signingModule"
source configPath
行不起作用,因为您需要指定文件的完整路径。
关于linux - 如何在远程机器上运行多个脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39996103/