LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   unison/iwatch sync - files disappearing from server (http://www.linuxquestions.org/questions/linux-networking-3/unison-iwatch-sync-files-disappearing-from-server-812636/)

edderkop 06-07-2010 06:42 AM

unison/iwatch sync - files disappearing from server
 
Hi all

I'm trying to set up a synchronization with unison and iwatch to (more or less) instantly sync files upon change in a directory tree.

iwatch calls unison like this:

Code:

unison /home/foo/vhosts/foo/my_vhost/bar.html ssh://server.tld//srv/www/vhosts/foo/bar.html -batch -terse -ui text -owner -group
I would expect unison to sync all files between the two servers. However, that is not the case. Everything works fine as long as the files are only created/changed/whatever on the server running unison. If a file is created on the server that unison is synchronizing to, it gets deleted the next time unison is called.

For example:

Code:

on the host running unison:

$ cd /home/foo/vhosts/foo/my_vhost
$ touch foo.bar

-- sshing to remote host ---

$ ssh remote.com
$ cd /srv/www/vhosts/foo
$ touch hello_world.html
$ exit

-- back on the server running unison --

$ unison /home/foo/vhosts/foo/my_vhost/foo.bar ssh://remote.com//srv/www/vhosts/foo/foo.bar -batch -terse -ui text -owner -group

I expected that both files get synchronized - foo.bar from the unison server to remote.com and hello_world.html from remote.com to the server running unison. Instead, hello_world.html gets deleted.

I've been working a while on this and don't seem to be able to figure it out. Maybe it's only an argument to unison to rectify it but I couldn't find anything adequate in the manpage either.

Any help will be greatly appreciated. TIA!

edderkop

edderkop 06-08-2010 06:24 AM

I was able to figure it out. I had a second synchronization process running - a different solution that I'd tried before (lsyncd) before giving up and using iwatch/unison. I'd totally forgotten that that process was still running. After killing it everything worked as expected. :-) :o

halvy 06-08-2010 07:13 AM

Glad to see you figured it out so quickly.

I just thought I'd add, for future reference that I used Unison for awhile..and found it 'ok' to get your feet wet in learning about Rsync..

After a lot of frustration with Unison.. it's lack of features, overwhelming use of terms that NOONE has a clue to what they EXACTLY mean, and the fact that it is not supported anymore (I think).. I just took the time to learn about using Rsync alone.

It's manual is cleaner and more easily understood... even tho it is basically the same otherwise as Rsyncs.

For instance, with the issue you were having.. the adding of the --delete switch would have been the cause of your problems.. however, (I think) that the ONLY way you could have REMOVED this switch from UNISON, would be to run it from the command line... which, at this point, you might as well do away with all the fluff & guff.. and go straight to using Rsync.

Anyways.. good luck in the future with your work & projects :)


All times are GMT -5. The time now is 01:16 AM.