I have local scripts that I would like to run on a remote server. I have already set up ssh key pairs to enable login without a password.
My current approach is to rsync the script to the server and then run it:
ssh user@remoteserver "rsync localserver:script.sh ./; ./script.sh; rm script.sh"
However, this seems like a hack; Is there a more user friendly way to do this?
update: since there are so many good answers, can anyone help me select the ‘best’ one by providing rationale?
SSH will take commands from
stdinedit:
-T Disable pseudo-tty allocation