Created
October 28, 2017 21:02
-
-
Save niklasl/c3c6750e2c4198ec0821e741e0b77b0b to your computer and use it in GitHub Desktop.
Crude fallback when unison isn't available on your local machine. (Note that this method stores duplicates of the files of interest on the server.)
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
# Paths of interest | |
LOCALDIR=syncdir | |
HOST=user@example.org | |
LANDINGDIR=landingdir | |
TARGETDIR=syncdir | |
# Sync files from local device to the server landing dir | |
rsync -auv --delete $LOCALDIR/ $HOST:$LANDINGDIR | |
# Two-way-sync the landing dir with the target dir | |
ssh $HOST " | |
unison $LANDINGDIR $TARGETDIR \ | |
-path paths/of/interest \ | |
-path general/notes \ | |
-path work/project | |
" || echo # suppress potential non-zero exit ... | |
# Get eventual changes back to local device | |
rsync -auv --delete $HOST:$LANDINGDIR/ $LOCALDIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment