As I was trying to automate my unit testing I run into this requirement, the general syntax to execute a command remotely is:
ssh -t user@host command
So for example if I wanted to execute my_script.sh on my home folder I could do:
ssh -t myusername@myserver /home/my_user/my_script.sh