Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    

1 Answer 1

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.

share|improve this answer
    
I tried using the -a option, but when syncing from client to server, I have a broken symlink on the server side. –  hmak Feb 24 '11 at 0: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 0: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 –  hmak Feb 24 '11 at 0: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 3:04
    
You definitely want to drop the -L option and use just -a. –  timd Feb 24 '11 at 5:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.