Skip to content

Instantly share code, notes, and snippets.

@matttrent
Last active March 25, 2018 20:36
Show Gist options
  • Save matttrent/feeab97d476f8dde7c0f713ef03c6f0a to your computer and use it in GitHub Desktop.
Save matttrent/feeab97d476f8dde7c0f713ef03c6f0a to your computer and use it in GitHub Desktop.
remote put/get scripts
#!/bin/bash
# syncs the default EC2 instance to current project (as defined by git repo)
# get the path to the project root (where the .git folder is)
project_path=`git rev-parse --show-toplevel 2> /dev/null`
if [ $? -eq 0 ]; then
# name of the project folder
project_name=`basename $project_path`
# rsync from server ~/projects/project-name
rsync -avL --cvs-exclude --progress \
# ignore the push-only folders
--exclude=/code --exclude=/scripts --exclude=/docs \
-e "ssh" $1 \
$REMOTE_INSTANCE_URL:projects/$project_name/ $project_path
fi
#!/bin/bash
# syncs the current project (as defined by git repo) to default EC2 instance
# get the path to the project root (where the .git folder is)
project_path=`git rev-parse --show-toplevel 2> /dev/null`
if [ $? -eq 0 ]; then
# name of the project folder
project_name=`basename $project_path`
# rsync to server ~/projects/project-name
rsync -avL --progress \
# ignore the pull-only folders
--exclude=/notebooks --exclude=/results \
-e "ssh" $1 \
$project_path $REMOTE_INSTANCE_URL:projects
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment