How to run a script on a remote host via SSH

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

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.