ssh to remote command prompt

Hi all,

Scenario - trying to run a batch job on a second machine.

DIR=directory
user=user
server=server

Here is what i have- ssh user@server 'sleep2; cd $DIR; <jobname>'

I have got access to the correct directory, i checked with a pwd command previous.

Problem is the job i am running isnt in this directory but is held on the system somewhere else, but it is required to run from here because of associated files...

Manually if I am on the comand prompt of the second machine i just have to type the <jobname> at the prompt of the $DIR....so how can i get the ssh to do the same from my local machine??

Hope this makes sense and someone can help.

Thanks
Hopper

Meybe you can try

ssh user@server 'sleep2; cd $DIR; ./<jobname>'
ssh user@server 'sleep2; cd $DIR; sh <jobname>'

(or whatever shell you use)

ssh user@server 'sleep2; cd $DIR; nohup <jobname> &'

allso have a look at the -n option of ssh