linux - 如何在远程机器上运行多个脚本

标签 linux bash shell ubuntu remote-access

我必须远程连接到网关(在 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

请帮我解决这个问题。提前致谢。

注意事项:

  1. 如果需要,我可以在该网关中复制粘贴我的文件。
  2. Gnome-Terminal 或任何其他替代品在我的网关中不起作用

最佳答案

ssh root@10.138.77.150 "cd /opt/swfiscal/signingModule && ./signingModule"

source configPath 行不起作用,因为您需要指定文件的完整路径。

关于linux - 如何在远程机器上运行多个脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39996103/

相关文章:

linux - 如何将一个目录中文件的前300行复制到另一个目录?

php - 如何使用来自 php 的一些参数运行 perl 脚本

linux - 快速查找具有给定 glob 的所有目录的方法

linux - 有没有办法只删除后面的重复项?

java - 在用户键入时编辑 shell 前缀

python - 无法找出 -11 的返回码是什么意思

linux - 捕获键盘事件的shell脚本

linux - Grep 多个字符串

Linux bash 将目录文件输出到带有 xargs 的文本文件并添加新行

bash脚本在文件中写入执行时间