Rsync supprime les liens symboliques

Fermé
nious99 Messages postés 3 Date d'inscription vendredi 1 juin 2012 Statut Membre Dernière intervention 1 juin 2012 - 1 juin 2012 à 14:55
nious99 Messages postés 3 Date d'inscription vendredi 1 juin 2012 Statut Membre Dernière intervention 1 juin 2012 - 1 juin 2012 à 17:54
Bonjour,

Je fais un rsync entre un répertoire local et un distant :
rsync --delete -rcvh /rep/local util@IP:rep/distant
Ca marche très bien : les nouveaux fichiers sont ajoutés, les modifications sont appliquées et les fichiers locaux supprimés le sont aussi en distant.
Mon problème est que sur le répertoire distant, j'ai des liens symboliques qui ne sont pas présents en local. Ces liens sont effacés par rsync et je n'arrive pas à trouver le moyen de les préserver.
Est-ce que quelqu'un aurait une solution ?

Merci d'avance


3 réponses

zipe31 Messages postés 36402 Date d'inscription dimanche 7 novembre 2010 Statut Contributeur Dernière intervention 27 janvier 2021 6 408
1 juin 2012 à 15:12
Salut,

Extrait :
SYMBOLIC LINKS

Three basic behaviors are possible when rsync encounters a symbolic link in the source directory.

By default, symbolic links are not transferred at all. A message "skipping non-regular" file is emitted for any symlinks that exist.

If --links is specified, then symlinks are recreated with the same target on the destination. Note that --archive implies --links.

If --copy-links is specified, then symlinks are "collapsed" by copying their referent, rather than the symlink.

rsync also distinguishes "safe" and "unsafe" symbolic links. An example where this might be used is a web site mirror that wishes ensure the rsync module they copy does not include symbolic links to /etc/passwd in the public section of the site. Using --copy-unsafe-links will cause any links to be copied as the file they point to on the destination. Using --safe-links will cause unsafe links to be omitted altogether.

Symbolic links are considered unsafe if they are absolute symlinks (start with /), empty, or if they contain enough ".." components to ascend from the directory being copied.
0
nious99 Messages postés 3 Date d'inscription vendredi 1 juin 2012 Statut Membre Dernière intervention 1 juin 2012
1 juin 2012 à 15:21
Merci pour cette réponse rapide, effectivement ça fonctionne très bien pour les liens symboliques dans la source mais pas pour ceux de la destination. Ce que je n'arrive pas à faire c'est à préserver les lien sur la destination alors qu'ils ne sont pas présents sur la source.
0
zipe31 Messages postés 36402 Date d'inscription dimanche 7 novembre 2010 Statut Contributeur Dernière intervention 27 janvier 2021 6 408
1 juin 2012 à 16:29
Essaye l'option "-K, --keep-dirlinks"... sans garantie ;-\
0
nious99 Messages postés 3 Date d'inscription vendredi 1 juin 2012 Statut Membre Dernière intervention 1 juin 2012
1 juin 2012 à 17:54
Ca ne fonctionne pas, je vais, en fait, liste les liens sur la destination et me servir de --exclude-from. C'est beaucoup moins pratique mais ça devrait marcher.

Merci
0