SSH with and without command gives different results

works as expected

[a ~]$ ssh 172.24.40.100
Last login: Mon Jan  1 06:07:24 2001 from 172.24.41.78
[b ~]# /path/script.sh

gives me error consistent with env setup

[a ~]$ ssh 172.24.40.100 /path/script.sh

Which implies the latter is running the script.sh on host a, when I want to 'launch' in from a, and 'run' it on b!?

what is the error? try qouting the script

[a ~]$ ssh 172.24.40.100 '/path/script.sh'

If your script needs interactive input, it might fail because of that. SSH will not, when not logging in, allocate a TTY, but just pipe back stdout/stderr and the exit code. Also, it will not invoke a login shell, so any personalized .login/.profile/.bash_profile will be left out. If you rely on a $PATH set in one of those it might fail too.

I found the solution, it was to source the profile I wanted before the command! :-

ssh 172.24.40.100 "source /root/.bash_profile; /scorpion2/start.sh

Cheers