I am trying to automate a few steps that I need to execute in a remote linux machine from my local ubuntu computer.
My shell script is as follows :-
#!/bin/sh
ssh XYZ '
qlogin -l cuda=1
'
When I am trying to execute it by collecting the ./fileName.sh
. I am getting
bash: line 2: qlogin: command not found
However, when I do it manually i.e. ssh into the cluster and than run this command , I am able to execute it.
Troubleshooting till now
Both the local and remote terminal is bash . This I got by
echo $0
When I manually ssh into the remote and print the path for qlogin (via
which qlogin
). I get
/opt/ge/bin/lx-amd64/qlogin
However, when I do the same via the script,I don't get any which means that qlogin is not installed.
- Finally, I the user executing the script and the user that logs in when i manually ssh are not the same (got it by printing the
who
).
What should I do ?