Then you're on the right track. My experience with ssh says it would run remotely. So make sure to
- omit the single quotes around the command line (but it wouldn't run locally with them anyway),
- replace <hostname> with the name of the host,
- replace <command> with the path to the script.
Well probably you did that. What makes you think it ran locally? I mean, what output did you expect? What did you get?
You could try with a simple known command first. E.g., "hostname" or "uname -a" -- without the double quotes. Like this,
ssh other-host uname -a
From the output it should be obvious where it ran (if the two machine have different names). If that still runs locally, check if your <hostname> gets resolved to the correct IP address. If you just run 'ssh <hostname>' and give no command, does that successfully give a shell on the remote host?