I have to remotely connect to a gateway (working on Linux platform), inside which I have couple of executable files (signingModule.sh and taxModule.sh). Now I want to write one script in my desktop which will connect to that gateway and run signingModule.sh and taxModule.sh in two different terminals.

I have written below code:

ssh root@ #to connect to gateway
sleep 5
cd /opt/swfiscal/signingModule #path of both modules
./signingModule #executable

but through this code I am able to connect my gateway but after connecting to gateway nothing is happening.

2nd code:

source configPath # file where i have given path of both the modules(configPath is placed in local machine)
cd $FCM_SCRIPTS # variable in which i have stored the path of modules
ssh root@ 'sh -' < signingModule #to connect and run one module (signingModule is placed in remote machine)

As an output of this I am getting: source: configPath: file not found

Please help me working this out. Thanks in advance.


  1. I can copy paste my files in that gateway if required.
  2. Gnome-Terminal or any other alternatives of this is not working in my gateway.
  3. I have to run all modules (signing and tax) in different terminal coz my other application will work only when these two modules are up. so to make them run simultaneously we have to run them in different tab or terminal.
  4. I have to write a script in my local machine which will run both modules (signing and tax) which are placed in remote gateway. So i want to run that script in my local machine which is gonna hit gateway's modules.
  • Please edit your question and clarify. Is configPath in the local or the remote machine? Is it in the directory you run the script from? Where is startSigningModule? Local or remote? We need to know what has to run on the local machine and what has to run in the remote in order to help you. – terdon Oct 12 '16 at 11:46
  • yes it is in the directory i am running the scripts from. Please let me know now if it is clear. I have two modules (signing and tax) in remote. which i have to run from local. so i have kept the path of modules (placed in remote) in configPath file. configPath file is present in local. – Siddharth Tiwari Oct 12 '16 at 12:43
  • not really. Please edit your question and explain clearly what files are in what machine and which commands are supposed to run on local and which on the remote. Also, why in different terminals? – terdon Oct 12 '16 at 15:38
  • I hope this will work. let me know if you want some more input – Siddharth Tiwari Oct 13 '16 at 6:41

The error you got means that file configPath doesn't exists in folder where you did the command source configPath.

Assuming that:

  • file configPath contains the statements:
    export FCM_SCRIPTS=/path/on/remote/machine
  • In /path/on/remote/machine folder is present an executable file signingModule
  • file configPath is located in /path/on/local/machine folder

If these assumptions are true, you should create on local machine a simple script /path/on/local/machine/remoteExecution.sh:


and try:

cd /path/on/local/machine 
ssh root@ 'bash -s' < <(cat configPath remoteExecution.sh)

where -s option means that commands are read from the standard input.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.