User Tools

Site Tools


rsync

rsync

copy remote

Receta 1

http://techtavern.wordpress.com/2008/11/19/resume-scprsync-file-transfer/

rsync -vrPtz -e ssh host:/remote_path/* /local_path/

Explained:

-e ssh rsync will use ssh client instead of rsh
-z compress file transfer
-t preserve time (other attributes as owner or permissions are also possible)
-P resume incomplete file transfer
-r recursive into subdirectories
-v verbose

Receta 2

#!/bin/bash

SOURCE="/var/www/wiki.legido.com/"
DESTINATION="/mnt/data/backups/wiki.legido.com/"
LOG="/var/log/backup_wiki_legido_com.log"
RSYNC="/usr/bin/rsync"
PORT="2223"
# Requires previous ssh keys exchange
# http://wiki.legido.com/doku.php?id=informatica:linux:ssh:login_intercambio_claves 
USER="user"
REMOTE_HOST="remotehost.domain.com"

DATE="$(date +%d/%m/%Y) $(date +%H:%M:%S)"

echo "
################### START: $DATE ##################"  >> $LOG

$RSYNC -arv --no-implied-dirs --ignore-errors --rsh "ssh -p$PORT" $USER@$REMOTE_HOST:$SOURCE $DESTINATION >> $LOG 2>&1

DATE="$(date +%d/%m/%Y) $(date +%H:%M:%S)"

echo "
################### END: $DATE ##################"  >> $LOG

Copiar evitando directorios de subversion

rsync -r --exclude=.svn /home/user/progname/ /home/user/progname.copy
rsync.txt · Last modified: 2015/04/13 22:19 (external edit)