Last active
August 25, 2016 10:54
-
-
Save phizaz/4d7181347dee90be6cecf1caa9422063 to your computer and use it in GitHub Desktop.
RemoteRun: run a script at a remote server seamlessly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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