I use inotify-tools and unison to synchronize folders between machines.
Because I have a large folder to synchronize, I just simply write an inotifywait script to do the job automatically.
Is it sensible to let inotifywait to monitor the subdirectories of the large folder to gain a better performance?
Gaining better performance with inotify-tools and unison.
4k Views Asked by ice6 At
2
There are 2 best solutions below
0
On
The unison-fsmonitor is not provided by ubuntu package until now:
- https://bugs.launchpad.net/ubuntu/+source/unison/+bug/1558737
- https://github.com/bcpierce00/unison/issues/208
If you want it fast locally
UNISON_VERSION=2.51.2
echo "Install Unison." \
&& apt install wget ocaml
&& pushd /tmp \
&& wget https://github.com/bcpierce00/unison/archive/v$UNISON_VERSION.tar.gz \
&& tar -xzvf v$UNISON_VERSION.tar.gz \
&& rm v$UNISON_VERSION.tar.gz \
&& pushd unison-$UNISON_VERSION \
&& make \
&& cp -t /usr/local/bin ./src/unison ./src/unison-fsmonitor \
&& popd \
&& rm -rf unison-$UNISON_VERSION \
&& popd
You should get better performance if you ditch
inotify-toolsand just use unison's native support for watching your folders for changes. By usinginotify-toolsand then callingunisonwhen a change occurs,unisonhas to "re-find" the change before it syncs. You could instead add the linerepeat = watchto your unison profile andunisonwill run continually and sync whenever there is a change. It detects the change with its own file-watcher utilityunison-fsmonitorthat communicates directly with unison.For more information, check out the latest changelog for unison 2.48.3 with major changes to
unison-fsmonitor.