sh 通过ssh备份rsync

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 通过ssh备份rsync相关的知识,希望对你有一定的参考价值。

#! /bin/bash

# archive mode, be verbose, use compression, preserve partial files, display progress
rsync -avvzhxP /source /destination/

# turn off compression for local transfers (more for network/internet)

# remote
rsync -avzPe "ssh -i ssh-priv.key" user@server:/data/dir destination/

# options
--ignore-existing # only copy if file doesnt exist yet (filename)
--update # only copy if local file is newer (filedate)
--remove-source-files # move files to remote


rsync -aH -e ssh --delete --exclude Cache --link-dest=yesterdaystargetdir remote1:sourcedir todaystargetdir



-a archive = -rlptgoD
 -r recurse into dirs
 -l cp symlinks as symlinks
 -p preserve permissions
 -t prsv. times
 -g prsv. groups
 -o prsv. owner
 -D prsv. device and special files

-h human readable

-u update = skip files that are newer on the receiver
-H prsv. hard-links

-n dry run

—delete delete files from receiver if missing in src

—exclude=dir
—partial keep partially transf. files
-P = —partial und —progress

—link-dest=dir link to previous increment

--log-file=

# usually rsync checks file size and time as heuristic
--ignore-times # ignores size and time, thus transfers all files unconditionally (either delta or --whole-file)
--checksum # only examines size, if size is equal md5 checksum is compared (read whole files)
--checksum

以上是关于sh 通过ssh备份rsync的主要内容,如果未能解决你的问题,请参考以下文章

sh 通过ssh快速远程目录rsync

10.28-10.29 rsync工具介绍及常用选项,rsync通过ssh同步

三十 rsync工具介绍rsync常用选项rsync通过ssh同步

三十 rsync工具介绍rsync常用选项rsync通过ssh同步

sh 通过SSH进行Rsync - (1GB网卡上的40MB / s)

sh 通过SSH进行Rsync - (1GB网卡上的40MB / s)