I run a script which calls another script through a ssh connection.
My script executes the following command:
ssh $cluster "bash $create 2 2 $parts"
where $cluster is the ssh string and $create is the absolute path of the bash script on the target machine. I run ssh $cluster "mkdir $serialized/$number" a few lines earlier, which works just fine.
However this command returns me:
bash: /data/.../create.bash 1 2 8: No such file or directory
The file is on the machine and I can execute the command there, but I can't figure out how to do it from within of a script over ssh. I tried different command, always receive this exception.
Thanks for your help!
Generally you shouldn't need to call bash in the first place. Even if the shell used by the remote machine isn't bash by default, you should set up the create.bash script such that the top of it looks like:
#!/bin/bash
and it'll already invoke bash.
Other things to consider:
put in the full path to bash in case the path is problematic.
make sure bash exists on the remote host, otherwise try 'sh' instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With