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?
Asked
Active
Viewed 3,859 times
3

Mike Pierce
- 1,390
- 1
- 12
- 35

ice6
- 1,173
- 9
- 9
-
after doing some research,just monitor the root directory will be ok – ice6 Jul 17 '13 at 05:14
-
Pay attention to the performance impairment while watching the root directory of a large tree. – zeekvfu Dec 03 '13 at 13:28
2 Answers
7
You should get better performance if you ditch inotify-tools
and just use unison's native support for watching your folders for changes. By using inotify-tools
and then calling unison
when a change occurs, unison
has to "re-find" the change before it syncs. You could instead add the line repeat = watch
to your unison profile and unison
will run continually and sync whenever there is a change. It detects the change with its own file-watcher utility unison-fsmonitor
that communicates directly with unison.
For more information, check out the latest changelog for unison 2.48.3 with major changes to unison-fsmonitor
.

Mike Pierce
- 1,390
- 1
- 12
- 35
-
If only `repeat= watch` worked out of the box on Ubuntu. It still doesn't. – Jortstek Oct 24 '21 at 12:43
1
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

Jean Claveau
- 1,101
- 1
- 13
- 15