Skip to content

Instantly share code, notes, and snippets.

@phizaz
Last active August 25, 2016 10:54
Show Gist options
  • Save phizaz/4d7181347dee90be6cecf1caa9422063 to your computer and use it in GitHub Desktop.
Save phizaz/4d7181347dee90be6cecf1caa9422063 to your computer and use it in GitHub Desktop.
RemoteRun: run a script at a remote server seamlessly
HOST="user@host"
REMOTE_PATH="/remoth/path"
RUN_COMMAND="docker run --rm -v ${REMOTE_PATH}:/run -w /run debian:jessie echo 'hello world!'"
echo "connecting to ${HOST} and sycing files to the remote ..."
rsync -a ./ "${HOST}:${REMOTE_PATH}"
echo "running the script at the remote ..."
ssh ${HOST} "cd ${REMOTE_PATH} && ${RUN_COMMAND}"
echo "syncing back files from the remote ..."
rsync -a --delete "${HOST}:${REMOTE_PATH}/" ./
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment