客户端和服务器端都是同一个程序文件。
作为 客户端使用参数:
D:\Program\Rsync_Sever\bin>rsync
rsync version 3.0.9 protocol version 30
Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
no socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, no xattrs, iconv, symtimes
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
rsync is a file transfer program capable of efficient remote update
via a fast differencing algorithm.
Usage: rsync [OPTION]... SRC [SRC]... DEST
or rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST
or rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST
or rsync [OPTION]... SRC [SRC]... rsync://[USER@]HOST[:PORT]/DEST
or rsync [OPTION]... [USER@]HOST:SRC [DEST]
or rsync [OPTION]... [USER@]HOST::SRC [DEST]
or rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]
The ':' usages connect via remote shell, while '::' & 'rsync://' usages connect
to an rsync daemon, and require SRC or DEST to start with a module name.
Options
-v, --verbose increase verbosity
-q, --quiet suppress non-error messages
--no-motd suppress daemon-mode MOTD (see manpage caveat)
-c, --checksum skip based on checksum, not mod-time & size
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
--no-OPTION turn off an implied OPTION (e.g. --no-D)
-r, --recursive recurse into directories
-R, --relative use relative path names
--no-implied-dirs don't send implied dirs with --relative
-b, --backup make backups (see --suffix & --backup-dir)
--backup-dir=DIR make backups into hierarchy based in DIR
--suffix=SUFFIX set backup suffix (default ~ w/o --backup-dir)
-u, --update skip files that are newer on the receiver
--inplace update destination files in-place (SEE MAN PAGE)
--append append data onto shorter files
--append-verify like --append, but with old data in file checksum
-d, --dirs transfer directories without recursing
-l, --links copy symlinks as symlinks
-L, --copy-links transform symlink into referent file/dir
--copy-unsafe-links only "unsafe" symlinks are transformed
--safe-links ignore symlinks that point outside the source tree
-k, --copy-dirlinks transform symlink to a dir into referent dir
-K, --keep-dirlinks treat symlinked dir on receiver as dir
-H, --hard-links preserve hard links
-p, --perms preserve permissions
-E, --executability preserve the file's executability
--chmod=CHMOD affect file and/or directory permissions
-A, --acls preserve ACLs (implies --perms)
-o, --owner preserve owner (super-user only)
-g, --group preserve group
--devices preserve device files (super-user only)
--specials preserve special files
-D same as --devices --specials
-t, --times preserve modification times
-O, --omit-dir-times omit directories from --times
--super receiver attempts super-user activities
-S, --sparse handle sparse files efficiently
-n, --dry-run perform a trial run with no changes made
-W, --whole-file copy files whole (without delta-xfer algorithm)
-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 to use
--rsync-path=PROGRAM specify the rsync to run on the remote machine
--existing skip creating new files on receiver
--ignore-existing skip updating files that already exist on receiver
--remove-source-files sender removes synchronized files (non-dirs)
--del an alias for --delete-during
--delete delete extraneous files from destination dirs
--delete-before receiver deletes before transfer, not during
--delete-during receiver deletes during the transfer
--delete-delay find deletions during, delete after
--delete-after receiver deletes after transfer, not during
--delete-excluded also delete excluded files from destination dirs
--ignore-errors delete even if there are I/O errors
--force force deletion of directories even if not empty
--max-delete=NUM don't delete more than NUM files
--max-size=SIZE don't transfer any file larger than SIZE
--min-size=SIZE don't transfer any file smaller than SIZE
--partial keep partially transferred files
--partial-dir=DIR put a partially transferred file into DIR
--delay-updates put all updated files into place at transfer's end
-m, --prune-empty-dirs prune empty directory chains from the file-list
--numeric-ids don't map uid/gid values by user/group name
--timeout=SECONDS set I/O timeout in seconds
--contimeout=SECONDS set daemon connection timeout in seconds
-I, --ignore-times don't skip files that match in size and mod-time
--size-only skip files that match in size
--modify-window=NUM compare mod-times with reduced accuracy
-T, --temp-dir=DIR create temporary files in directory DIR
-y, --fuzzy find similar file for basis if no dest file
--compare-dest=DIR also compare destination files relative to DIR
--copy-dest=DIR ... and include copies of unchanged files
--link-dest=DIR hardlink to files in DIR when unchanged
-z, --compress compress file data during the transfer
--compress-level=NUM explicitly set compression level
--skip-compress=LIST skip compressing files with a suffix in LIST
-C, --cvs-exclude auto-ignore files the same way CVS does
-f, --filter=RULE add a file-filtering RULE
-F same as --filter='dir-merge /.rsync-filter'
repeated: --filter='- .rsync-filter'
--exclude=PATTERN exclude files matching PATTERN
--exclude-from=FILE read exclude patterns from FILE
--include=PATTERN don't exclude files matching PATTERN
--include-from=FILE read include patterns from FILE
--files-from=FILE read list of source-file names from FILE
-0, --from0 all *-from/filter files are delimited by 0s
-s, --protect-args no space-splitting; only wildcard special-chars
--address=ADDRESS bind address for outgoing socket to daemon
--port=PORT specify double-colon alternate port number
--sockopts=OPTIONS specify custom TCP options
--blocking-io use blocking I/O for the remote shell
--stats give some file-transfer stats
-8, --8-bit-output leave high-bit chars unescaped in output
-h, --human-readable output numbers in a human-readable format
--progress show progress during transfer
-P same as --partial --progress
-i, --itemize-changes output a change-summary for all updates
--out-format=FORMAT output updates using the specified FORMAT
--log-file=FILE log what we're doing to the specified FILE
--log-file-format=FMT log updates using the specified FMT
--password-file=FILE read daemon-access password from FILE
--list-only list the files instead of copying them
--bwlimit=KBPS limit I/O bandwidth; KBytes per second
--stop-at=y-m-dTh:m Stop rsync at year-month-dayThour:minute
--time-limit=MINS Stop rsync after MINS minutes have elapsed
--write-batch=FILE write a batched update to FILE
--only-write-batch=FILE like --write-batch but w/o updating destination
--read-batch=FILE read a batched update from FILE
--protocol=NUM force an older protocol version to be used
--iconv=CONVERT_SPEC request charset conversion of filenames
--tr=BAD/GOOD transliterate filenames
-4, --ipv4 prefer IPv4
-6, --ipv6 prefer IPv6
--version print version number
(-h) --help show this help (-h is --help only if used alone)
example: rsync.exe -av --delete 192.168.1.2::n8contents /cygdrive/d/n8contents
--------------------------------------------------------------------------------------------------------------------------------------------------------
作为服务器使用的参数:
D:\Program\Rsync_Sever\bin>rsync --daemon --help
rsync version 3.0.9 protocol version 30
Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
no socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, no xattrs, iconv, symtimes
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
Usage: rsync --daemon [OPTION]...
--address=ADDRESS bind to the specified address
--bwlimit=KBPS limit I/O bandwidth; KBytes per second
--config=FILE specify alternate rsyncd.conf file
--no-detach do not detach from the parent
--port=PORT listen on alternate port number
--log-file=FILE override the "log file" setting
--log-file-format=FMT override the "log format" setting
--sockopts=OPTIONS specify custom TCP options
-v, --verbose increase verbosity
-4, --ipv4 prefer IPv4
-6, --ipv6 prefer IPv6
--help show this help screen
If you were not trying to invoke rsync as a daemon, avoid using any of the
daemon-specific rsync options. See also the rsyncd.conf(5) man page.
D:\Program\Rsync_Sever\bin>rsync --daemon --help
rsync version 3.0.9 protocol version 30
Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
no socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, no xattrs, iconv, symtimes
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
Usage: rsync --daemon [OPTION]...
--address=ADDRESS bind to the specified address
--bwlimit=KBPS limit I/O bandwidth; KBytes per second
--config=FILE specify alternate rsyncd.conf file
--no-detach do not detach from the parent
--port=PORT listen on alternate port number
--log-file=FILE override the "log file" setting
--log-file-format=FMT override the "log format" setting
--sockopts=OPTIONS specify custom TCP options
-v, --verbose increase verbosity
-4, --ipv4 prefer IPv4
-6, --ipv6 prefer IPv6
--help show this help screen
If you were not trying to invoke rsync as a daemon, avoid using any of the
daemon-specific rsync options. See also the rsyncd.conf(5) man page.
example: rsync.exe --config rsyncd.conf --daemon --no-detach
配置文件 rsyncd.conf 内容:
use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log
uid = 0
gid = 0
# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#
[test]
path = /cygdrive/c/work
read only = false
transfer logging = yes
[n8contents]
path=/cygdrive/D/User/hren/AppData/Roaming/AbcInfo/N8GroupClient
read only=false
transfer logging=true
-------------------------------------------------------------------------------------------------------------
使用cygrunsrv.exe可以把rsync作为服务器程序来运行:
cygrunsrv.exe的使用说明:
C:\Program Files\ICW\bin>cygrunsrv -h
Usage: cygrunsrv [OPTION]...
Main options: Exactly one is required.
-I, --install
-R, --remove
-S, --start
-E, --stop
-Q, --query
-L, --list [server] Lists services that have been installed
with cygrunsrv.
Required install options:
-p, --path
Miscellaneous install options:
-P, --crs-path
when installing a service on a remote machine.
-a, --args
is given to the service application on startup.
-c, --chdir
directory for the application.
-e, --env Optional environment strings which are added
to the environment when service is started.
You can add up to 255 environment strings using
the `--env' option.
Note: /bin is always added to $PATH to allow all
started applications to find at least cygwin1.dll.
-d, --disp
of the service. Defaults to service name.
-f, --desc
description.
-t, --type [auto|manual] Optional start type of service. Defaults to `auto'.
-u, --user
Defaults to SYSTEM account.
-w, --passwd
if a user is given. If a user has an empty
password, enter `-w '. If a user is given but
no password, cygrunsrv will ask for a password
interactively.
-s, --termsig
when service is stopped.
or a signal name such as HUP, INT, QUIT, etc.
Default is TERM.
-z, --shutsig
when shutdown has been initiated. Default is the
same signal as defined as termination signal.
-y, --dep
before this new service. The --dep option may
be given up to 16 times, listing another dependent
service each time.
-0, --stdin
Default is /dev/null.
-1, --stdout
Default is /var/log/
-2, --stderr
Default is /var/log/
-x, --pidfile
after fork().
Default is that application must not fork().
-n, --neverexits Service should never exit by itself.
-O, --preshutdown Stop service application during system preshutdown.
-o, --shutdown Stop service application during system shutdown.
(Only one of --preshutdown and --shutdown is
accepted. Preshutdown is preferred, but only
available since Windows Vista/Longhorn. On earlier
OS versions it's silently converted to --shutdown).
-i, --interactive Allow service to interact with the desktop
(No effect since Windows Vista/Longhorn).
-j, --nohide Don't hide console window when service interacts
with desktop.
Informative output:
-V, --verbose When used with --query or --list, causes extra
information to be printed.
-h, --help print this help, then exit.
-v, --version print cygrunsrv program version number, then exit.
Report bugs to
把Rsync安装成服务器程序:
Cygrunsrv.exe -I RsyncServerN8 -p "N:/RsyncServer/rsync.exe" -P "N:/RsyncServer/cygrunsrv.exe" -c "N:/RsyncServer" -d "RsyncN8" -f "N8Sync" -t manual -0 "N:/RsyncServer/rsyncd-stdin.log" -1 "N:/RsyncServer/rsyncd-stdout.log" -2 "N:/RsyncServer/rsyncd-stderr.log" -a "--config rsyncd.conf --daemon --no-detach"
详细参数说明见:
rsync.html
rsyncd.conf.html