Skip to content

Instantly share code, notes, and snippets.

@ryought
Created May 28, 2018 11:21
Show Gist options
  • Save ryought/cb7d6ae700261991080342644118ce67 to your computer and use it in GitHub Desktop.
Save ryought/cb7d6ae700261991080342644118ce67 to your computer and use it in GitHub Desktop.
ssh先のフォルダとの相互rsyncを変更を感知して自動でrsyncする
#!/bin/bash
set -Ceu
DEST='remote:/dir/to/folder/'
EXCLUDE=".git/ heavyfolder/"
EXCLUDECMD=''
for file in $EXCLUDE
do
EXCLUDECMD+="--exclude '$file' "
done
CMD="rsync -av -e ssh . $DEST --update --exclude 'autosync.sh' $EXCLUDECMD \
&& rsync -av -e ssh $DEST . --update --exclude 'autosync.sh' $EXCLUDECMD"
watchman-make -p '**/*' --run "$CMD"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment