0

I'm trying to setup rsync to work with symlinks.

Client to Server: For example on my client machine I have a symlink, when I sync to server, it syncs the actual file, which is what I want.

Server to Client: On the server, if I update the file and sync from server to client, it's replacing my symlink with the file, this is not what I want.

Problem: I need the client symlink to remain intact, and rsync to update the actual file on the client instead.

I've been messing around with the options and can't get it right

Any ideas?

Thanks.

makstaks
  • 101

1 Answers1

0

I think if you simply do rsync -a client/ server/ and rsync -a server/ client/ you should be OK. I tested this with a symlink to a file, and every edit of my file on both sides resulted in an updated file and the symlink was left intact.

timd
  • 91
  • 1
  • 4
  • I tried using the -a option, but when syncing from client to server, I have a broken symlink on the server side. – makstaks Feb 24 '11 at 00:13
  • hmak - you are not using the -L option as well? Can we see your actual rsync commands on both systems? – timd Feb 24 '11 at 00:24
  • after trying -L, the symlink resolves properly and on my server side, I have the actual file. Now when I try to sync from server to client it overwrites my symlink, i'm using -aL – makstaks Feb 24 '11 at 00:32
  • You probably don't want the `-L` option, just `-a`. Are your symlinks relative (->../foo/bar) or absolute (->/foo/bar). Transferring absolute links to a different directory will probably break things. Can you modify your links to be relative? – Zoredache Feb 24 '11 at 03:04
  • You definitely want to drop the `-L` option and use just `-a`. – timd Feb 24 '11 at 05:45
  • it doesn't work with just the -a because I end up with a broken link on the server side. – makstaks Feb 24 '11 at 19:05