Skip to content

Instantly share code, notes, and snippets.

@Jaid
Last active November 27, 2018 14:59
Show Gist options
  • Save Jaid/4cf808e1a5cf63950f0c634aa60eb1eb to your computer and use it in GitHub Desktop.
Save Jaid/4cf808e1a5cf63950f0c634aa60eb1eb to your computer and use it in GitHub Desktop.
Run a Bash script on a remote server via SSH and SCP
#!/usr/bin/bash
SCRIPT=/c/tmp/setup.bash
SSH_USER=jaid
SSH_HOST=example.com
scp $SCRIPT $SSH_USER@$SSH_HOST:~/local.bash
ssh $SSH_USER@$SSH_HOST "DEBIAN_FRONTEND=noninteractive PS4='[:\$LINENO] ' bash -e -x ~/local.bash"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment