- I want to keep files instantaneously in-sync across two workstations
- I want the solution to be platform-independent (mostly)
- I want this to run in the foreground in a tmux pane so I can easily monitor
- I want one simple command that I can re-use for any combination of target files/directories and destination directories
- I want some control on how deletions are handled
- Preferably, I won't have to mess with
fsevents
orinotify
or maintaining additional scripts
https://github.com/facebook/watchman (specifically, watchman-make
with --run
) and an ssh connection makes this super easy.
brew install watchman
I want to continuously sync ~/do/project
to do.stav.xyz:~/do/project
:
export WROOT=do SHOST='do.stav.xyz' WATCHED_DIR='project' && \
watchman-make --root $WROOT --pattern "$WATCHED_DIR"'/*' \
--run "rsync --progress --links --update --delete-after --times \
--inplace --recursive --verbose --executability \
--rsh ssh $(realpath $WROOT/$WATCHED_DIR)/ "$SHOST:$WROOT/$WATCHED_DIR""