請選擇 進入手機版 | 繼續訪問電腦版
搜索
熱搜: 活動 交友 discuz
查看: 8603|回復: 0

[Linux] Rsync 基本使用 - 遠端rsync WebApplication佈署範例

[複製鏈接]
發表於 2016-4-29 10:32:22 | 顯示全部樓層 |閱讀模式
  1. rsync -av /來源目錄 /目的路徑/
複製代碼
簡單的範例實在:
  1. rsync -av /home/www/www.project.com/webroot www-data@10.1.2.10:/home/www/www.project.com/
複製代碼



再來個Exclude範例用法:
  1. rsync -av  --delete --exclude "web/upload" --exclude "yii" /home/www/www.project.com/webroot www-data@10.1.2.10:/home/www/www.project.com/
複製代碼



參數表:
  1. -v, --verbose               increase verbosity
  2.      --info=FLAGS            fine-grained informational verbosity
  3.      --debug=FLAGS           fine-grained debug verbosity
  4.      --msgs2stderr           special output handling for debugging
  5. -q, --quiet                 suppress non-error messages
  6.      --no-motd               suppress daemon-mode MOTD (see manpage caveat)
  7. -c, --checksum              skip based on checksum, not mod-time & size
  8. -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
  9.      --no-OPTION             turn off an implied OPTION (e.g. --no-D)
  10. -r, --recursive             recurse into directories
  11. -R, --relative              use relative path names
  12.      --no-implied-dirs       don't send implied dirs with --relative
  13. -b, --backup                make backups (see --suffix & --backup-dir)
  14.      --backup-dir=DIR        make backups into hierarchy based in DIR
  15.      --suffix=SUFFIX         set backup suffix (default ~ w/o --backup-dir)
  16. -u, --update                skip files that are newer on the receiver
  17.      --inplace               update destination files in-place (SEE MAN PAGE)
  18.      --append                append data onto shorter files
  19.      --append-verify         like --append, but with old data in file checksum
  20. -d, --dirs                  transfer directories without recursing
  21. -l, --links                 copy symlinks as symlinks
  22. -L, --copy-links            transform symlink into referent file/dir
  23.      --copy-unsafe-links     only "unsafe" symlinks are transformed
  24.      --safe-links            ignore symlinks that point outside the source tree
  25.      --munge-links           munge symlinks to make them safer (but unusable)
  26. -k, --copy-dirlinks         transform symlink to a dir into referent dir
  27. -K, --keep-dirlinks         treat symlinked dir on receiver as dir
  28. -H, --hard-links            preserve hard links
  29. -p, --perms                 preserve permissions
  30. -E, --executability         preserve the file's executability
  31.      --chmod=CHMOD           affect file and/or directory permissions
  32. -A, --acls                  preserve ACLs (implies --perms)
  33. -X, --xattrs                preserve extended attributes
  34. -o, --owner                 preserve owner (super-user only)
  35. -g, --group                 preserve group
  36.      --devices               preserve device files (super-user only)
  37.      --specials              preserve special files
  38. -D                          same as --devices --specials
  39. -t, --times                 preserve modification times
  40. -O, --omit-dir-times        omit directories from --times
  41. -J, --omit-link-times       omit symlinks from --times
  42.      --super                 receiver attempts super-user activities
  43.      --fake-super            store/recover privileged attrs using xattrs
  44. -S, --sparse                handle sparse files efficiently
  45.      --preallocate           allocate dest files before writing them
  46. -n, --dry-run               perform a trial run with no changes made
  47. -W, --whole-file            copy files whole (without delta-xfer algorithm)
  48. -x, --one-file-system       don't cross filesystem boundaries
  49. -B, --block-size=SIZE       force a fixed checksum block-size
  50. -e, --rsh=COMMAND           specify the remote shell to use
  51.      --rsync-path=PROGRAM    specify the rsync to run on the remote machine
  52.      --existing              skip creating new files on receiver
  53.      --ignore-existing       skip updating files that already exist on receiver
  54.      --remove-source-files   sender removes synchronized files (non-dirs)
  55.      --del                   an alias for --delete-during
  56.      --delete                delete extraneous files from destination dirs
  57.      --delete-before         receiver deletes before transfer, not during
  58.      --delete-during         receiver deletes during the transfer
  59.      --delete-delay          find deletions during, delete after
  60.      --delete-after          receiver deletes after transfer, not during
  61.      --delete-excluded       also delete excluded files from destination dirs
  62.      --ignore-missing-args   ignore missing source args without error
  63.      --delete-missing-args   delete missing source args from destination
  64.      --ignore-errors         delete even if there are I/O errors
  65.      --force                 force deletion of directories even if not empty
  66.      --max-delete=NUM        don't delete more than NUM files
  67.      --max-size=SIZE         don't transfer any file larger than SIZE
  68.      --min-size=SIZE         don't transfer any file smaller than SIZE
  69.      --partial               keep partially transferred files
  70.      --partial-dir=DIR       put a partially transferred file into DIR
  71.      --delay-updates         put all updated files into place at transfer's end
  72. -m, --prune-empty-dirs      prune empty directory chains from the file-list
  73.      --numeric-ids           don't map uid/gid values by user/group name
  74.      --usermap=STRING        custom username mapping
  75.      --groupmap=STRING       custom groupname mapping
  76.      --chown=USER:GROUP      simple username/groupname mapping
  77.      --timeout=SECONDS       set I/O timeout in seconds
  78.      --contimeout=SECONDS    set daemon connection timeout in seconds
  79. -I, --ignore-times          don't skip files that match in size and mod-time
  80. -M, --remote-option=OPTION  send OPTION to the remote side only
  81.      --size-only             skip files that match in size
  82.      --modify-window=NUM     compare mod-times with reduced accuracy
  83. -T, --temp-dir=DIR          create temporary files in directory DIR
  84. -y, --fuzzy                 find similar file for basis if no dest file
  85.      --compare-dest=DIR      also compare destination files relative to DIR
  86.      --copy-dest=DIR         ... and include copies of unchanged files
  87.      --link-dest=DIR         hardlink to files in DIR when unchanged
  88. -z, --compress              compress file data during the transfer
  89.      --compress-level=NUM    explicitly set compression level
  90.      --skip-compress=LIST    skip compressing files with a suffix in LIST
  91. -C, --cvs-exclude           auto-ignore files the same way CVS does
  92. -f, --filter=RULE           add a file-filtering RULE
  93. -F                          same as --filter='dir-merge /.rsync-filter'
  94.                              repeated: --filter='- .rsync-filter'
  95.      --exclude=PATTERN       exclude files matching PATTERN
  96.      --exclude-from=FILE     read exclude patterns from FILE
  97.      --include=PATTERN       don't exclude files matching PATTERN
  98.      --include-from=FILE     read include patterns from FILE
  99.      --files-from=FILE       read list of source-file names from FILE
  100. -0, --from0                 all *-from/filter files are delimited by 0s
  101. -s, --protect-args          no space-splitting; only wildcard special-chars
  102.      --address=ADDRESS       bind address for outgoing socket to daemon
  103.      --port=PORT             specify double-colon alternate port number
  104.      --sockopts=OPTIONS      specify custom TCP options
  105.      --blocking-io           use blocking I/O for the remote shell
  106.      --stats                 give some file-transfer stats
  107. -8, --8-bit-output          leave high-bit chars unescaped in output
  108. -h, --human-readable        output numbers in a human-readable format
  109.      --progress              show progress during transfer
  110. -P                          same as --partial --progress
  111. -i, --itemize-changes       output a change-summary for all updates
  112.      --out-format=FORMAT     output updates using the specified FORMAT
  113.      --log-file=FILE         log what we're doing to the specified FILE
  114.      --log-file-format=FMT   log updates using the specified FMT
  115.      --password-file=FILE    read daemon-access password from FILE
  116.      --list-only             list the files instead of copying them
  117.      --bwlimit=RATE          limit socket I/O bandwidth
  118.      --outbuf=N|L|B          set output buffering to None, Line, or Block
  119.      --write-batch=FILE      write a batched update to FILE
  120.      --only-write-batch=FILE like --write-batch but w/o updating destination
  121.      --read-batch=FILE       read a batched update from FILE
  122.      --protocol=NUM          force an older protocol version to be used
  123.      --iconv=CONVERT_SPEC    request charset conversion of filenames
  124.      --checksum-seed=NUM     set block/file checksum seed (advanced)
  125. -4, --ipv4                  prefer IPv4
  126. -6, --ipv6                  prefer IPv6
  127.      --version               print version number
複製代碼
[Linux] Rsync 基本使用 - 遠端rsync WebApplication佈署範例
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

本論壇為非營利之網路平台,所有文章內容均為網友自行發表,不代表論壇立場!若涉及侵權、違法等情事,請告知版主處理。


Page Rank Check

廣告刊登  |   交換連結  |   贊助我們  |   服務條款  |   免責聲明  |   客服中心  |   中央分站

手機版|中央論壇

GMT+8, 2024-12-8 07:54 , Processed in 0.024904 second(s), 17 queries .

Powered by Discuz!

© 2005-2015 Copyrights. Set by YIDAS

快速回復 返回頂部 返回列表