I'm setting up a system which automatically generates computing jobs on a local (Linux) machine, copies them to a cluster and submits them to the queuing system.

I try to avoid the need for scripts which run on the cluster (this way, there's only one script, and it runs where I can debug it).

I've got my authorized_keys set up, so after creating all the required files locally, I do this, from the local case directory:

ssh cluster 'mkdir /home/user/casedir'
scp localdir/* cluster:/home/user/casedir/
ssh cluster 'qsub /home/user/casedir/run_script.sge'

...this creates the case directory on the cluster, copies over all the files I need but then fails in the third line, saying: qsub: command not found

However, if I interactively type ssh cluster to get a shell on the cluster, then type the qsub command, it launches the job and runs just fine!

... what am I getting wrong here? The cluster is running a fairly old version of the Sun Grid Engine, in case that's relevant.

I guess I could locally produce and copy over a bash script which will execute the qsub command on the cluster but that seems like a very roundabout way of doing this.

1 Answer 1


I'm guessing you have added qsub to your $PATH in the .bashrc or .profile files of your user on the cluster. Those are not read when executing a command via ssh.

It should work fine if you use the full path to qsub:

ssh cluster '/usr/local/bin/qsub /home/user/casedir/run_script.sge'

Obviously, you'll need to change /usr/local/bin/qsub to whatever the path of qsub is on your cluster. If you don't know it, log on to the cluster and run type qsub.

  • That's it! I had to add source /etc/bashr; source /etc/profile to the line, that does it! I also have to cd to the case directory before submitting, else all data lands in the root directory... Thanks a lot!
    – Zak
    Sep 18, 2015 at 16:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .