Last active
January 29, 2016 16:51
-
-
Save sfoster/033f243ace3f0d67b3c3 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
# synch files across a local project directory to a remote server | |
# place pisync.sh at the top of your project directory, or alias it | |
# ip or hostname of the pi | |
REMOTE_HOST=10.0.1.15 | |
# path to the project directory on the pi | |
PROJECT=/home/pi/mirror | |
BASE_DIR=$(dirname $(readlink -f $0)) | |
WDIR=`pwd` | |
DIR=${WDIR#${BASE_DIR}} | |
EXCLUDES="node_modules" | |
echo relative path: $DIR, sync to $REMOTE_HOST:$PROJECT | |
# push | |
rsync -a --exclude $EXCLUDES ./ pi@$REMOTE_HOST:$PROJECT/${DIR:1}/ | |
# then pull | |
rsync -a --exclude $EXCLUDES pi@$REMOTE_HOST:$PROJECT/${DIR:1}/ ./ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment