It's more than one year I have written my script, and, really, I have not
touched the unison options since the first days. I have fixed many bugs in
my script, but the core part is compeltely stable for me.
This script is working "as is" for all hosts:
- new hosts freshly installed
- working hosts
- reinstalled machines
My best surprise is that reinstalled machines recover their files, dispite
the relative complexity of my setup. Some servers have full access over
the whole unison directory (classic bidirectionnal sync between servers);
most clients have read only access (they can write on the local copy, but,
on the next hours, it's overwritten by the server version: unidirectionnal
sync), except a subdiretory that every client can write in ... but that is
read only for other clients, except a sub-sub dir that is readable only by
the client (and R-W by server only, not visible to other clients).
After re-installing a client, it recovers all data it had before the crash
disk, even data in the directory only this client can write. Unison
handles this case wonderfully well. Better than I was hoping. I was really
expecting glitches; I was fearing to need to spend days on digging this
aspect. And the magic point is that, as soon as a client have lost it's
/root/.unison folder, then, only the server version of /mnt/unison maters.
And similarly, if by mistake I damage a file on a server (bad rm, bad vim,
bad mv ... ), I just need to "rm -rf /root/.unison" before the next sync,
and other servers will cancel the mistake.
My sync script is executed hourly, and blindly, by cron. I never get
emaild the output; it's completely non interactive. I have set all non
interactive options, so that cron always does something.
I have watchdogs (munin) to warn me when 4 consecutive sync go wrong, or
when a client is broken. Then, I run the sync script manually to read the
error message (my script is also able to automatically fix some common
problems: in some case, it may automatically erase .unison, or archives
files, so that when an archive is broke, it fixes the issue by itself non
interactively in 3 runs).
=> you may dislike my script, or the options I have set in there; but keep
in mind that this script allows me to keep 25 hosts perfectly sync since
over one year without any human interaction. All I have to do is to add a
hostname in an env variable.
That's why I have batch flag set. First sync or not.
This script works fine even for first sync on freshly installed machines.
I have never done the first sync manually; I just add the hostname of new
client in some variable, and 1h later, it's sync (I don't even install
unison; my script installs the package if it's missing).
I had a hard time fixing collisions between the various versions of
unison; some hosts have 2.40, other have 2.48; plus, there are two
versions of 2.48 depending on some system lib (forgot which one; there is
a bug open about it, not by me). (
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=880449 )
Post by Alan Schmitt ***@polytechnique.org [unison-users]You should not use batch for that first sync, as it's going to ask you
if you really want to synchronise as it's the first synchronisation.
The message I get does not look like this.
Post by Alan Schmitt ***@polytechnique.org [unison-users]The archive is not there (as expected, you deleted it). What happens if
you try with batch=false? Best, Alan
That's a good question.
....
batch = false
....
Looking for changes
[update] Loading archive from /root/.unison/ar2c1d703ec0ff7f254880d799168c3104
[exn] Converting an End_of_file to Fatal:
End_of_file exception raised in loading archive (this indicates a bug!)
Fatal error: End_of_file exception raised in loading archive (this
indicates a bug!)
[server: update] Loading archive from
/root/.unison/ara1d6d2823d0ccd837b7ecd333ca2c3c3
[server: update] Archive /root/.unison/ara1d6d2823d0ccd837b7ecd333ca2c3c3
not found
.... so, roughly the same message.
I have never removed .unison from my main server.
Server has
unison version 2.40.61
unison version 2.48.3
target has
2.40.65
2.40.102
2.48.3
.... all combinations fail with the same message.
--
Post by Alan Schmitt ***@polytechnique.org [unison-users]o_/ DEMAINE Benoît-Pierre (aka DoubleHP) http://benoit.demaine.info/
If computing were an exact science, IT engineers would'nt have work \_o<
"So all that's left, Is the proof that love's not only blind but deaf."
(FAKE TALES OF SAN FRANCISCO, Arctic Monkeys)