Issue with running a script via ssh

Hi, I'm trying to run a user defined shell script with options and arguments via ssh but getting error as

ksh: Script.sh: not found

.
Here is what i'm running:

ssh -t username@server 'cd /path/to/script; script.sh -t start

here '-t' with script.sh, is an user defined option and 'start' is also user defined argument. I'm running this script from Linux (2.6.18-419.el5) and doing ssh to HP-UX B.11.23. Other commands like 'top', 'ls', 'pwd' are working with ssh, but the user defined script with option and argument are returning 'not found' error. Appreciate any help.

Hi, try:

ssh -t username@server 'cd /path/to/script; ./script.sh -t start'

/path/to/script is not in the PATH variable.

Thank you for the reply. Tried with

./

before the script name and ran the ssh command. But getting new error.

ScriptName: Error: Cannot write in PID directory: /path

That seems to be a permission error, just guessing. Please post more context.

And, watch your case syntax: ksh: Script.sh: not found by no means can complain about script.sh -t start - script.sh and Script.sh mean two different things.