It turns out that the 'fatal error' message is more appropriate than I thought. The origin of the trouble (which would in a two-machines setup occur if a host changes its name) is that the two Android devices to sync with host names were both determined to be localhost
, even though they are different and specified by different IP-addresses.
According to the unison manual the hostname can be given by hand by exporting the UNISONLOCALHOSTNAME
environment variable. Since unison does not create a login shell however it cannot be exported in the .profile
file on the sync devices. It turned out that also the ./ssh/environment
file of my ssh servers (SshDroid in both cases) was not read. Finally the android hostname (which can be set with setprop net.hostname [hostname]
) is also not read by unison. Instead it seems to default to localhost
.
Therefore I came up with the following workaround:
unison -servercmd "export UNISONLOCALHOSTNAME=host1; unison" ssh://"$myhost1//dir" "$HOME/dir" unison -servercmd "export UNISONLOCALHOSTNAME=host2; unison" ssh://"$myhost2//dir" "$HOME/dir"
Here the -servercmd
option defines which command to run on the remote devices to start unison. In my version it exports the UNISONLOCALHOSTNAME
to two different values first.
Then the hosts are recognized to be different and it is possible to repeatedly sync multiple 'tips' from a central 'hub' in a 'star' setup.