Rsync

From Logicalwebhost-Wiki

Jump to: navigation, search

you can sync stuff up using rsync, either for backup, or if you have redundant servers on a load balancer, here are some options:

  -v, --verbose               increase verbosity
       -q, --quiet                 decrease verbosity
       -c, --checksum              always checksum
       -a, --archive               archive mode, equivalent to -rlptgoD
       -r, --recursive             recurse into directories
       -R, --relative              use relative path names
           --no-relative           turn off --relative
           --no-implied-dirs       don’t send implied dirs with -R
       -b, --backup                make backups (see --suffix & --backup-dir)
           --backup-dir            make backups into this directory
           --suffix=SUFFIX         backup suffix (default ~ w/o --backup-dir)
       -u, --update                update only (don’t overwrite newer files)
           --inplace               update the destination files inplace
       -K, --keep-dirlinks         treat symlinked dir on receiver as dir
       -l, --links                 copy symlinks as symlinks
       -L, --copy-links            copy the referent of all symlinks
           --copy-unsafe-links     copy the referent of "unsafe" symlinks
           --safe-links            ignore "unsafe" symlinks
       -H, --hard-links            preserve hard links
       -p, --perms                 preserve permissions
       -o, --owner                 preserve owner (root only)
       -g, --group                 preserve group
       -D, --devices               preserve devices (root only)
       -t, --times                 preserve times
       -S, --sparse                handle sparse files efficiently
       -n, --dry-run               show what would have been transferred
       -W, --whole-file            copy whole files, no incremental checks
           --no-whole-file         turn off --whole-file
       -x, --one-file-system       don’t cross filesystem boundaries
       -B, --block-size=SIZE       force a fixed checksum block-size
       -e, --rsh=COMMAND           specify the remote shell
           --rsync-path=PATH       specify path to rsync on the remote machine
           --existing              only update files that already exist
           --ignore-existing       ignore files that already exist on receiver
           --delete                delete files that don’t exist on sender
           --delete-excluded       also delete excluded files on receiver
           --delete-after          receiver deletes after transfer, not before
           --ignore-errors         delete even if there are I/O errors
           --max-delete=NUM        don’t delete more than NUM files
           --partial               keep partially transferred files
           --partial-dir=DIR       put a partially transferred file into DIR
           --force                 force deletion of dirs even if not empty
           --numeric-ids           don’t map uid/gid values by user/group name
           --timeout=TIME          set I/O timeout in seconds
       -I, --ignore-times          turn off mod time & file size quick check
           --size-only             ignore mod time for quick check (use size)
           --modify-window=NUM     compare mod times with reduced accuracy
       -T  --temp-dir=DIR          create temporary files in directory DIR
           --compare-dest=DIR      also compare received files relative to DIR
           --link-dest=DIR         create hardlinks to DIR for unchanged files
       -P                          equivalent to --partial --progress
       -z, --compress              compress file data
       -C, --cvs-exclude           auto ignore files in the same way CVS does
           --exclude=PATTERN       exclude files matching PATTERN
           --exclude-from=FILE     exclude patterns listed in FILE
           --include=PATTERN       don’t exclude files matching PATTERN
           --include-from=FILE     don’t exclude patterns listed in FILE
           --files-from=FILE       read FILE for list of source-file names
       -0  --from0                 all file lists are delimited by nulls
           --version               print version number
           --daemon                run as an rsync daemon
           --no-detach             do not detach from the parent
           --address=ADDRESS       bind to the specified address
           --config=FILE           specify alternate rsyncd.conf file
           --port=PORT             specify alternate rsyncd port number
           --blocking-io           use blocking I/O for the remote shell
           --no-blocking-io        turn off --blocking-io
           --stats                 give some file transfer stats
           --progress              show progress during transfer
           --log-format=FORMAT     log file transfers using specified format
           --password-file=FILE    get password from FILE
           --bwlimit=KBPS          limit I/O bandwidth, KBytes per second
           --write-batch=FILE      write a batch to FILE
           --read-batch=FILE       read a batch from FILE
           --checksum-seed=NUM     set block/file checksum seed
       -4  --ipv4                  prefer IPv4
       -6  --ipv6                  prefer IPv6
       -h, --help                  show this help screen

the ones you probably care about are these:

      -v, --verbose
             This  option  increases  the amount of information you are given
             during the transfer.  By default, rsync works silently. A single
             -v  will  give you information about what files are being trans-
             ferred and a brief summary at the end.
      -q, --quiet
             This  option  decreases  the amount of information you are given
             during the transfer, notably  suppressing  information  messages
             from  the remote server. This flag is useful when invoking rsync
             from cron.
      -a, --archive
             This is equivalent to -rlptgoD. It is a quick way of saying  you
             want recursion and want to preserve almost everything.
             Note  however that -a does not preserve hardlinks, because find-
             ing multiply-linked files is  expensive.   You  must  separately
             specify -H.
      -r, --recursive
             This  tells  rsync to copy directories recursively. If you don’t
             specify this then rsync won’t copy directories at all.
Personal tools