Reputation: 53
tl;dr
Is there an "omit link times" option for rsync similar to the "omit dir times" option for folders? Or a different approach to achieve this?
Setup
I am trying to sync two folders on different ubuntu machines. In my actual setup, it's a python script running in a GitLab pipeline, executing shell code via subprocess. However, I can replicate the problem manually on the console as well. When I do that I can fix it by using "sudo", but in the pipeline I would prefer not to use these privileges.
Problem
This is the command I use:
rsync -rltOEh --delete -e ssh <user_name>@<source_server>:<copy_path> <target_path>
It works for all files except symlinks. For (I think all?) symlinks in the folder, I get:
rsync: [generator] failed to set times on "<path_to_symlink>": Operation not permitted (1).
The user is in a group with write-permissions on the source and target folders and all subfolders and files including the symlinks. At first I was also getting this error for folders, but fixed it with the -O option (omit dir times). When I skip links by omitting the -l option, I get no errors, but obviously I want to copy the links as well. I guess a workaround would be to search the paths for all symlinks and copy only those in a separate command. That seems quite messy though. I also get no errors when I omit the -t option so no time information is copied. But I do need the time info in the target files.
I would appreciate any help on this. Thanks in advance!
Upvotes: 0
Views: 46