Retour : Page Principale > sommaire aide > sommaire aide logiciels

Rsync


Comment configurer rsync pour synchroniser deux dossiers sur des machines différentes par ssh ?

rsync -a --delete -e ssh /home/jpm/travail 162.38.234.6:/home/partage/jpm/

Restaurer depuis Adansonia vers un poste
rsync -a -e ssh /home/[compte]/sauvegardes/home/[compte]/ [compte]@162.38.234.[IP]:/home/[compte]

Envoyer depuis son poste vers Adansonia pour une sauvegarde ponctuelle
rsync -a -e ssh /home/[compte]/ [compte]@162.38.234.1:/home/[compte]/[mon_dossier]

Comment renvoyer un log de rsync dans un fichier ?

en ajoutant 2>&1 aprés le chemin vers le fichier et en utilisant l'option --log-format de rsync.
Exemple :
sync -a --delete --log-format="%o %f %l %t" -e ssh /home/jpm/Tela_Botanica 162.38.234.6:/home/partage/jpm/ >> /home/jpm/log.txt 2>&1

Quels sont les formats de log ?

  • %h for the remote host name
  • %a for the remote IP address
  • %l for the length of the file in bytes
  • %p for the process id of this rsync session
  • %o for the operation, which is either "send" or "recv"
  • %f for the filename
  • %P for the module path
  • %m for the module name
  • %t for the current date time
  • %u for the authenticated username (or the null string)
  • %b for the number of bytes actually transferred
  • %c when sending files this gives the number of checksum bytes
    • received for this file
The default log format is "%o %h [%a] %m (%u) %f %l", and a "%t
[%p] " is always added to the beginning when using the "log
file" option.