hnsl / unox

Unison OS X unison-fsmonitor adapter.
101 stars 12 forks source link

Difficulty getting fsmonitor working over SSH #4

Closed wamatt closed 9 years ago

wamatt commented 9 years ago

I have two machines, mtbook and mtpro, that I'm trying to keep in sync using unox and Unison.

now lets say I want to keep ~/tmp/bla1 directory in sync with ~/tmp/bla2 using the watch command.

It works no problem on either mtbook or mtpro. However when I try do it across SSH and using unox, it complains Fatal error: Server: No file monitoring helper program found.

Unox is installed on both machines, and running repeat watch on either machine works fine... so long as SSH is not used.

Additionally Unison works fine over SSH... so long as repeat watch is not used.

So it's only the combination of SSH and repeat watch that's failing, not either by itself. Any ideas?

---- output ----

matt@mtbook:~% type unison-fsmonitor
unison-fsmonitor is /usr/local/bin/unison-fsmonitor
matt@mtpro:~/tmp% type unison-fsmonitor
unison-fsmonitor is /usr/local/bin/unison-fsmonitor

Both monitors are in the path too.

Works fine over SSH, without repeat watch

matt@mtpro:~/tmp% unison ~/tmp/bla2 ssh://mtbook.local//Users/Matt/tmp/bla2
Contacting server...
Connected [//mtbook.local//Users/Matt/tmp/bla2 -> //mtpro.local//Users/Matt/tmp/bla2]
Looking for changes
  Waiting for changes from server
Reconciling changes
Nothing to do: replicas have not changed since last sync.

Gives error over SSH when repeat watch used.

matt@mtpro:~/tmp% unison ~/tmp/bla2 ssh://mtbook.local//Users/Matt/tmp/bla2 -repeat watch
Contacting server...
Connected [//mtbook.local//Users/Matt/tmp/bla2 -> //mtpro.local//Users/Matt/tmp/bla2]
Looking for changes
  Waiting for changes from server
Reconciling changes
Nothing to do: replicas have not changed since last sync.
Fatal error: Server: No file monitoring helper program found
wamatt commented 9 years ago

Ok I figured this out. In case anyone interested and sees this.

/usr/local/bin was not in my non-interactive shell path. This needs to be set in .bashrc

You can test as follows:

matt@mtpro:~% ssh mtbook 'echo $PATH'
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Note the use of single quotes. It tells ssh to eval on the remote machine, not local.

gitfoxi commented 6 years ago

I had this problem. I was reading the error un-carefully. It needs a monitor program on the server. I installed this on the client but didn't think about the server needing a monitor also.

uduse commented 6 years ago

I had this problem too. I had unison installed on both sides and two-way syncs works fine locally on both servers. However, it prompts Fatal error: Server: No file monitoring helper program found when I sync one server remotely with another. My $PATH echo of the remote non-interactive shell shows the correct path that includes where the unison is.

My solution is similar to @wamatt 's yet more brutal. On the top of my ~/.bashrc:

# If not running interactively, don't do anything
case $- in
   *i*) ;;
     *) return;;
esac

I simply commented all of this, so the shell does not differentiate interactive mode or not:

# If not running interactively, don't do anything
# case $- in
#    *i*) ;;
#      *) return;;
# esac