NAME
openrsync —
synchronise local and remote
files
SYNOPSIS
openrsync |
[-0468BCDEFHILOPRSTWVabcdefghiklmnopqrtuvxyz]
[-e program]
[-f filter]
[--address=sourceaddr]
[--append]
[--backup-dir=directory]
[--bwlimit=limit] [--cache
| --no-cache]
[--checksum-seed=NUM]
[--chmod=MODE]
[--compare-dest=directory]
[--compress-level=NUM]
[--contimeout=seconds]
[--copy-dest=directory]
[--copy-unsafe-links]
[--del] [--delay-updates]
[--delete-before]
[--delete-during]
[--delete-delay]
[--delete-after]
[--delete-excluded]
[--exclude pattern]
[--exclude-from=file]
[--extended-attributes]
[--files-from=filespec]
[--force]
[--ignore-errors]
[--ignore-existing]
[--ignore-non-existing]
[--include pattern]
[--include-from=file]
[--inplace]
[--keep-dirlinks]
[--link-dest=directory]
[--list-only]
[--log-file=file]
[--log-file-format=format]
[--max-delete=MAX]
[--max-size=size]
[--min-size=size]
[--modify-window=sec]
[--no-implied-dirs]
[--no-motd]
[--numeric-ids]
[--partial]
[--partial-dir=DIR]
[--password-file=pwfile]
[--port=service]
[--progress]
[--protocol=VER]
[--read-batch=file]
[--remove-source-files]
[--rsync-path=program]
[--safe-links]
[--size-only]
[--sockopts=sockopts]
[--specials] [--stats]
[--suffix=suffix]
[--super]
[--timeout=seconds]
[--only-write-batch=file |
--write-batch=file]
source ... directory |
openrsync |
--daemon [-46hv]
[--address=bindaddr]
[--bwlimit=bwlimit]
[--config=configfile]
[--no-detach]
[--log-file=logfile]
[--port=service]
[--sockopts=sockopts] |
DESCRIPTION
The openrsync utility synchronises files
in the destination directory with one or more
source files. Either the source
or the destination directory may be remote, but not
both. The arguments are as follows:
-4,--ipv4- Use IPv4 when connecting to a remote host, or binding to a local address.
If
openrsyncis configured to use an--rshprogram named “ssh”, then it will pass-4to it. -6,--ipv6- Use IPv6 when connecting to a remote host, or binding to a local address.
As with the
-4option,openrsyncwill pass-6to the--rshprogram if it is named “ssh”. -8,--8-bit-output- Do not escape high-bit characters in the output (which is otherwise the default).
-a,--archive- Shorthand for
-Dgloprt. --address=sourceaddr- When connecting to an rsync daemon, use sourceaddr as the source address for connections, which is useful on machines with multiple interfaces.
--append- If the destination file exists and is shorter than the source file then
rsync will append the difference to the destination file. If after the
transfer the whole-file checksums do not match then the destination file
will be updated via the usual block-based delta-merge protocol. This
option implies
--inplace. -b,--backup- Make a backup of changed files with ~ suffix.
--backup-dirdirectory- When combined with the
--backupflag,openrsyncwill store backups of files being replaced in the designated backup directory on the receiving side. Can be combined with the--suffixflag to name the backup files with a suffix. The default is to not append a suffix.If specified as a relative path, the backup directory will be contained within the copied tree, and may cause conflicts or be subject to
--deleterules. It is advised to use an absolute path outside of the copied tree, or a relative path such as "../". -B,--block-size=BLOCKSIZE- Specify the block size to be used for file transfers. The upper bound is 512M, but it is enforced only if a differential transfer is required.
--blocking-io- This flag is ignored by openrsync, but is accepted for compatibility.
--bwlimitlimit- Limit transfer speed to limit kilobytes/sec. The
limit may also contain any of the suffixes described
in the
--max-sizedefinition of size. --cache- Use the operating system buffer cache when reading and writing files. This
is the default on all operating systems except macOS, where
openrsyncsetsF_NOCACHEby default to limit memory growth. Setting this option will enabling caching by not setting any flags. --no-cache- Sets
O_DIRECTwhen reading and writing files to avoid using the buffer cache. Setting this option can avoid filling the cache with files that will not be read again, such as during a backup. This is the default on macOS, whereF_NOCACHEis used instead ofO_DIRECT. -c,--checksum- Use full-file checksums to determine which files have changed and should be transferred, rather than the usual file size and modification time "quick check".
--checksum-seed=NUM- Use NUM as the seed for both the 4-byte block and
MD4 file checksums. By default, NUM is randomly
generated, but if set to zero directs
openrsyncto use time(3) as the checksum seed. --chmod=MODE- Modify the permissions on files that are transferred, overriding the
original source permissions. Only has an effect if
--permsis specified as well. The MODE string can be a comma separated list of literal (755) or relative (g+w) permissions.openrsyncalso supports two additional extensions to relative permissions, adding a ‘D’ or ‘F’ infront of the relative permissions will apply the changes to only directories or files respectively. For example: -chmod=Dg+w,Fo-w --compare-dest=directory- Use directory as an alternate base directory to compare files against on
the destination machine. If file in directory is
found and identical to the sender's file, the file will not be
transferred. Multiple
--compare-destdirectories may be provided. If directory is a relative path, it is relative to the destination directory. -z,--compress- Compress file data during transfer to reduce the amount of data transferred.
--compress-level=NUM- Set the compression level used by
--compress. --contimeout=seconds- Set the connection timeout in seconds. Exit if no connection established within the specified time. The default is 0, which means no timeout.
--copy-dest=directory- Use directory as an alternate base directory to compare files against on
the destination machine. If file in directory is
found and identical to the sender's file, the file will be locally copied.
Multiple
--copy-destdirectories may be provided. If directory is a relative path, it is relative to the destination directory. -L,--copy-links- Copy targets of symbolic links, rather than the link itself.
--copy-unsafe-links- Copy targets of symbolic links that are unsafe (absolute symlinks or where the target reaches outside the copied tree).
-k,--copy-dirlinks- Copy targets of symbolic links that point to directories only.
-C,--cvs-exclude- Exclude a common list of files as CVS would. The patterns deployed are
specifically:
Followed by any patterns included in $HOME/.cvsignore and theRCS SCCS CVS CVS.adm RCSLOG cvslog.* tags TAGS .make.state .nse_depinfo *~ #* .#* ,* _$* *$ *.old *.bak *.BAK *.orig *.rej .del-* *.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln core .svn/ CVSIGNOREenvironment variable.The
-Cflag also adds a “dir-merge” CVS rule to include per-dir .cvsignore files. All of these rules are appended to the end of the filter list with the equivalent of specifying-f“-C”-f“:C”. -D- Also transfer device and special files. Shorthand for
--devices--specials. --del,--delete- Delete files in directory not found in
source directories. Only applicable with
-r. --delay-updates- Delay updates of (only) plain files until all other operations are complete. This is done to be more atomic. Requires extra space in the destination directory up to the amount of the whole tree.
--delete-before- Execute the above described
--deletebehavior before the transfer begins. This is the default timing when --delete- is used. This option is mutually exclusive with
--delete-during,--delete-delay, and--delete-after. --delete-during- Execute the above described
--deletebehavior as the transfer happens, right before each directory to be transferred is checked for updates. This option is mutually exclusive with--delete-before,--delete-delay, and--delete-after. --delete-delay- Execute the above described
--deletebehavior after the transfer happens, but collect the list to be deleted right before each directory to be transferred is checked for updates. This option is mutually exclusive with--delete-before,--delete-during, and--delete-after. --delete-after- Execute the above described
--deletebehavior after the transfer has completed. This option is mutually exclusive with--delete-before,--delete-during, and--delete-delay. --delete-excluded- When used in combination with any one of the above
--deleteoptions, supplied--excludepatterns will not prevent a file from being deleted. -d,--dirs- Copies directories, which are normally skipped unless
--recursiveis specified. Directory contents are not copied, unless the path specified includes a trailing slash (“dir/”), or is the literal “.”. --excludepattern- Exclude files matching pattern.
--exclude-from=file- Load patterns and rules from file.
-E,--extended-attributes- Apple specific option to copy extended attributes, resource forks, and ACLs. Requires at least Mac OS X 10.4 or suitably patched rsync.
--executability- Preserve the executability of regular files (i.e., a file is
"executable" if at least one 'x' mode bit is enabled in its
permissions). If the source file is executable, then for each 'r' mode bit
enabled in the destination file's permissions, the corresponding 'x' mode
bit will be enabled. If the source file is not executable then all ugo 'x'
mode bits of the destination file will be disabled. This option has no
effect if
--permsis also specified. -0,--from0- Use a null ('\0') character, rather than a newline to separate filenames
read from:
--exclude-from,--include-from,--files-from, and any merged files specified in--filterrules. Does not affect--cvs-exclude. --files-from=filespec- Load list of files to transfer (as opposed to the command line) from filespec. Filespec can be of the form hostname:port:path.
--force- Force deletion of non-empty directories about to be replaced by a
non-directory. This option has no effect if any of the
--deleteoptions are present. --ignore-errors- Works in conjunction with
--deleteto delete files despite I/O errors. -y,--fuzzy- Look for files in the destination directory that might be the same to use
as a basis to avoid copying the entire file. The first file with an
identical size and modification time is used to try to reduce the total
amount of data that has to be transferred.
Note that the use of the
--deleteoption might get rid of any potential fuzzy-matches, so either use--delete-afteror specify some exclusions to prevent this. --ignore-existing- Ignore files that already exist.
--ignore-non-existing,--existing- Ignore files that do not already exist (do not create them).
-I,--ignore-times- Do not skip based on file size and modification time.
--includepattern- Include files matching pattern.
--include-from=file- Load patterns and rules from file.
--devices- Also transfer device files.
-eprogram,--rsh=program- Specify alternative communication program, defaults to
ssh(1). The
RSYNC_RSHenvironment variable will be used if an-eoption is not present. Note thatopenrsyncwill generally handle quotes, but it makes no attempt to deal with escape sequences. In particular, escaped quotation marks will not be escaped. -F- Adds a standard .rsync-filter dir-merge filter
rule. Specifically,
-Fwill add “: /.rsync-filter” the first time it is seen, and “- .rsync-filter” the second time it is seen. Subsequent uses have no effect. -ffilter,--filter=filter- Process filter against the global filter chain. The
specified filter may be a rule to include a filter
file, or to include a per-directory filter file. Regular filter files are
processed immediately, while per-directory filter files are processed as
directories are encountered. See
PATTERNS AND RULES for more
details about the syntax and capabilities of
openrsyncfilters. -g,--group- Set the group name to match the source. For example, group
"kristaps" with ID 1000 on a remote server is matched to group
"kristaps" on the local machine with ID 2000. If
--numeric-idsis also given or if the remote group name is unknown on the local machine, set the numeric group ID to match the source instead. -H,--hard-links- Attempt to preserve hard links within the list of files transferred.
-h,--human-readable- Display numbers of bytes in human readable units. If specified once, uses units of 1000, if specified twice uses units of 1024.
--help- Print a brief description of all options.
-l,--links- Also transfer symbolic links. The link is transferred as a standalone file: if the destination does not exist, it will be broken.
--inplace- Avoid creating temporary files, instead operating on files directly in place in the destination. This option has some notable trade-offs that must be considered prior to using it. For example, hardlinks will not be broken even if a file is no longer hardlinked in the source directory.
-K,--keep-dirlinks- When a directory is sent, and the receiving side has a symlink to a
directory in that place, follow that symlink and place the directory's
contents in that symlinked dir. This does not facilitate an escalation of
privilege, as in all cases
openrsyncremains constrained to making changes only as permitted by the credentials of the caller, which mitigates some security concerns. --link-dest=directory- Use directory as an alternate base directory to compare files against on
the destination machine. If file in directory is
found and identical to the sender's file, the file will be hardlinked.
Multiple
--link-destdirectories may be provided. If directory is a relative path, it is relative to the destination directory. --list-only- Instead of transferring files, only list them. This option is implied if there is only a single source argument and no destination argument.
--log-file=file- Specify a file to log to instead of
stdout. This implies a
--log-file-formatof “%i %n%L” if none was previously specified. --log-file-format=format- Specify a log format for each file involved in the transfer. The
format argument may contain any number of tokens,
like “%i”, with special meaning. The following tokens are
defined for daemon mode, but are also accepted for normal
openrsyncusage:- %a
- The client's remote IP address.
- %h
- The client's hostname.
- %m
- The module requested by the client.
- %P
- The path to the module requested by the client.
- %u
- The username that the client has authenticated as.
These tokens are globally defined:
- %b
- The number of bytes transferred.
- %B
- The file mode, in a human-readable format.
- %c
- The size of block checksums received for the source file. This is not currently implemented by this implementation, but will be accepted.
- %f
- The long-form filename without a trailing “/” indicator.
- %G
- The group of the file in decimal format, or “DEFAULT”
when the group is
0. - %I
- The itemized list of updates including unchanged files, as if
--itemize-changeswas specified twice. - %i
- The itemized list of updates, as if
--itemize-changeswas specified. - %l
- The length of the file.
- %L
- An indicator of the file being a symlink or a hardlink. For hardlinks, this token is replaced with “=> FILENAME”. For symlinks, this token is replaced with “=> FILENAME”. For non-links, this token is replaced with the empty string.
- %M
- The mtime of the file, in full date-time format.
- %n
- The short-form filename with a trailing “/” indicator.
- %o
- The operation conducted on the file. This can be one of “send”, “recv”, or “del.”.
- %p
- The PID of the rsync client.
- %t
- The current time, in date-time format.
- %U
- The user of the file in decimal format, or “DEFAULT”
when the user is
0.
--max-deleteMAX- Once MAX files have been deleted, do not delete any more files.
--max-sizesize- Don't transfer any file that is larger than size bytes. Alternatively size may instead use a multiplier (such as 0B, 100B, 1023B, 1K, 1.5K, 5.5M; or any sequence with a case-insensitive terminal scale multiplier of B, K, M, G, T, P, or E; corresponding to bytes, kilobytes, and so on) to specify the size.
--min-sizesize- Don't transfer any file that is smaller than size
bytes. See
--max-sizeon the definition of size. --modify-windowsec- When comparing file modification times for the purpose of speeding up transfers consider offsets of up to sec seconds the same.
-n,--dry-run- Do not actually modify the destination. Mainly useful in combination with
-v. --no-motd- Do not display the Message of the Day.
--numeric-ids- Ignore user and group names, use numeric user and group IDs only. Has no
effect unless
-gor-ois also given. -O,--omit-dir-times- Do not perserve the modification times of directories. This can be
expensive when the directories reside on NFS. This option is inferred if
you use
--backupwithout--backup-dir. -o,--owner- Set the user name to match the source, with similar matching logic as for
-g. If--numeric-idsis also given or if the remote user name is unknown on the local machine, set the numeric user ID to match the source instead. Only works if run as root. -P- Shorthand for
--partial--progress. -p,--perms- Set destination file or directory permissions to match the source when it is updated.
--partial- Do not remove partially transferred files if
openrsyncis interrupted, which opens up the possibility for them to be easily resumed later. --partial-dir=DIR- Store all partially transferred files in DIR to
allow an interrupted transfer to resume without re-transferring files.
Implies
-partial. --password-file=pwfile- Define a file to read the password from when connecting to an rsync
daemon. The password should be written on the first line of the file, and
may have a terminating newline. The pwfile is
expected to not be readable by 'other', and to be owned by root if
openrsyncis running as root. --port=service- Specify an alternative TCP port number. The service can be given as a decimal integer or as a name to be looked up in the services(5) database. The default is “rsync”.
-m,--prune-empty-dirs- Prune empty directories from the file list on the receiver side. Empty directories may be excluded from pruning with an exclude or protect filter rule. A directory wich only contains other empty, non-excluded directories, is also considered empty.
-q,--quiet- Suppress all non-error related informational messages.
--progress- Periodically report file transfer progress.
--protocol=VER- Force
openrsyncto operate using the specified protocol version. Normally the protocol version is negotiated automatically, but an older protocol version can be forced with this flag. -r,--recursive- If source designates a directory, synchronise the directory and the entire subtree connected at that point. If source ends with a slash, only the subtree is synchronised, not the source directory itself. If source is a file, this has no effect.
--read-batch=file- Read a batch file previously prepared by
openrsyncfrom file. See the--write-batchoption for a description of a batch file. When reading a batch file, the source arguments are optional and ignored if specified. --remove-source-files- Remove source files as they are transferred into
directory. Files are only removed once they are
confirmed to be fully in place. By default
openrsyncwill delete files as the transfer progresses, but given its asynchronous nature there may be a noticeable delay between a given file finishing its transfer and its subsequent removal.When combined with
--delay-updates, files will be removed in a larger batch toward the end of the transfer. -R,--relative- Normally, pathnames on the commandline omit the directory components. This option will include the dir components.
--no-implied-dirs- Changes the default behavior of
--relativesuch that implied directories do not have their attributes modified, or are created with default attributes, rather than the source attributes, if they do not exist. This allows the implied directories to differ, including being a symlink on one side and a real directory on the other. If an existing implied directory on the destination is a symlink, it will be followed rather than removed and recreated as a real directory. The--no-implied-dirsoption, like--keep-dirlinks, does not facilitate an elevation of privilege as it remains constrained by the credentials of the caller, which mitigates some security concerns. --rsync-path=program- Run program on the remote host instead of the default rsync.
--size-only- Skip files whose sizes match (regardless of timestamp).
--safe-links- Skip any symlinks that are unsafe (absolute symlinks or where the target is outside the copied tree).
--sockopts=sockopts- Set custom sockopts on the socket created to
communicate with an rsync daemon. sockopts should be
of the form “name[=value][,...]”, where
name matches an
SO_*option described in setsockopt(2). Note that only the following options are currently supported:SO_KEEPALIVESO_REUSEADDRSO_SNDBUFSO_RCVBUFSO_SNDLOWATSO_RCVLOWATSO_SNDTIMEOSO_RCVTIMEOSO_REUSEPORTMay not be available on all systems. -S,--sparse- Attempt to efficiently handle sparse files. Note that attempting to
combine
-Sand--inplacewill result in an error. --specials- Also transfer fifo and unix domain socket files.
--stats- Print verbose statistics about the transfer at the end of the run.
Provides details about how much data transfer was saved by
openrsync. --suffixsuffix- Sets the suffix to be appended to filenames when creating backups on the
receiver before replacing files. Defaults to ~ except when combined with
--backup-dirwhere the default is an empty string. --super- Always attempt traditionally super-user activities. This flag mostly
interacts with the
--owner,--group, and--devicesoptions, which may be permitted to unprivileged users on the receiving end in some configurations.--no-superis also supported to avoid them entirely. -T,--temp-dir=directory- Instead of creating temporarily files in the destination directory, create them in the specified temporary directory. If this directory is on a different filesystem, that will require moving the file rather than renaming it into place, and is therefore not atomic.
--timeout=seconds- Set the I/O timeout in seconds. Exit if no data was transferred for the specified time. The default is 0, which means no timeout.
-t,--times- Set destination file and directory modification time to match the source when it is updated or created.
-u,--update- Skip existing files on the destination that have a modification time newer than the source file.
-v,--verbose- Increase verbosity. Specify once for files being transferred, twice for specific status, thrice for per-file transfer information, and four times for per-file breakdowns.
-x,--one-file-system- Do not cross filesystem boundaries. If this option is repeated, all mount point directories from the copy are omitted. Otherwise, it includes an empty directory at each mount point it encounters.
-V,--version- Print version and exit.
-W,--whole-file- Copy the entire file rather than using the rsync incremental algorithm. This option may be faster, especially if the network link is faster than the disk.
--only-write-batch=file- Prepare a batch file and write it to file. With this
option, the batch file is written without updating the destination. See
the below
--write-batchoption for a description of a batch file. --write-batch=file- Prepare a batch file and write it to file. A batch
file is composed of a small heading describing the transfer parameters
negotiated, followed by a raw dump of the data transmitted by the sender.
When used with
--read-batchon the other side, the transfer is simply replayed from the batch file against the application's reeceiver, and the destination tree is updated accordingly.Batch files are intended to reproduce an update to a destination tree to many other identical trees without needing to establish a direct connection between them. This mechanism also avoids having to perform many of the intermediate steps required for a transfer, such as receiver-side checksums and blocking.
A remote source or
directory has the syntax
host:path for connecting via
ssh(1), or
rsync://host/path
or host::path for connecting to
a remote daemon. Subsequent to the first remote
source, the host may be dropped to become just
:path or ::path.
For connecting to a remote daemon with
rsync://host or
host::path, the first path
component is interpreted as a "module":
host::module/path.
This only applies to the first source invocation;
subsequent to that, the module should not be specified.
By default, new destination files and directories are given the current time and the source file permissions. Updated files retain their existing permissions. It is an error if updated files have their file types change (e.g., updating a directory with a file).
At this time, source may only consist of
regular files, directories (only with -r), or
symbolic links (only with -l). The destination
directory must be a directory and is created if not
found.
openrsync also supports a
--daemon mode, which may be run either standalone or
may be invoked by, e.g., inetd(8) or similar services that hand a socket off to an
external program for handling.
Daemon options that are shared with the non-daemon mode of
openrsync behave as described above. Options
specific to daemon mode are as follows:
--config=configfile- Load daemon configuration from the named configfile
instead of the default location. By default,
openrsyncwill look for its configuration at /etc/rsyncd.conf. See rsyncd.conf(5) for details of the format of this file. --no-detach- Run the
openrsyncdaemon in the foreground, instead of the background.
Note that the openrsync daemon mode will
log to syslog(3) by default unless --log-file is
specified, regardless of whether --no-detach has
been specified to run in the foreground or not.
PATTERNS AND RULES
The -f, --include,
--include-from, --exclude,
and --exclude-from options may be used to load a
filter rule or a set of filter rules. A single filter rule consists of a
type, an optional set of
modifiers, and a pattern. Each
type has a short name and a long name. These will be
described in more depth shortly.
A filter file is a set of rules, one per line. Comments are accepted, starting with a ‘#’. Empty lines are ignored.
Each rule is of the following form:
<TYPE>[,<MODIFIERS>] <PATTERN>
If the short name is used, then the comma separating the modifiers from the rule type is optional. The delimiter between the type/modifiers and the pattern may also be an underbar instead of a space.
The following rule types are supported:
| LONG NAME | SHORT NAME | DESCRIPTION |
| exclude | - | Exclude a file from the transfer |
| include | + | Include a file from the transfer |
| merge | . | Merge rules in from a file |
| dir-merge | : | Merge rules in from a per-directory file |
| hide | H | Hide a file from the transfer |
| show | S | Do not hide a file from the transfer |
| protect | P | Protect a file from deletion |
| risk | R | Do not protect a file from deletion |
| clear | ! | Clear the current filter list |
The following rule modifiers are supported for the “exclude” and “include” rule types:
| MODIFIER | DESCRIPTION |
| / | Match against the absolute pathname of the entry |
| ! | Take effect if the pattern does not match the entry |
| C | Insert the global CVS exclusions |
| s | Marks a rule as sender-side only |
| r | Marks a rule as receiver-side only |
| p | Marks a rule as perishable (do not prevent removal of a directory) |
The above modifiers will be ignored if applied to other rule types, with the exception of “merge” and “dir-merge” rules. See the Merge Rules section for more details of the semantics.
Include and Exclude Rules
The six basic types of include and exclude rules briefly described above are “exclude”, “include”, “hide”, “show”, “protect”, “risk”.
The “hide” and “show” types are sender-side versions of the “exclude” and “include” rules, while the “protect” and “risk” types are their receiver-side equivalents.
Each of these rules take a pattern that is typically matched against the basename of a transfer candidate's name. A trailing ‘/’ in the pattern indicates that the entry should only match a directory name, while a leading ‘/’ indicates that the pattern is anchored to the beginning of the transfer path. The beginning of the transfer path is either the root of the transfer, or the directory containing a dir-merge file if the rule in question comes from a dir-merge file. A ‘/’ at any other position, or a “**” in the pattern, will match against the full path to the transfer entry beginning at the root of the transfer.
Patterns may contain any of the following wildcards.
| WILDCARD | DESCRIPTION |
| ? | Matches any character, except ‘/’ |
| * | Matches zero or more characters, except ‘/’ |
| ** | Matches zero or more characters |
| [ | Character class, as in POSIX regular expressions |
| /*** | Matches a directory and all of its contents |
Backslashes may be used to escape one of the above wildcard characters, but is ordinary when appearing before any other character.
Note that exclude rules with the “C” modifier applied do not take a pattern.
Merge Rules
The merge rules, “merge” and
“dir-merge”, are another way to insert a filter rule file.
“merge” rules are evaluated once as soon as they are
processed, and the rules read in are inserted at the same position as the
merge file. “dir-merge” rules are evaluated as
openrsync progresses through the file list,
searching each directory encountered for the file named in the rule's
pattern.
If a “dir-merge” rule appears before a “clear” rule, it will not be processed at all.
“dir-merge” rules are inserted into their own chain of rules, rather than directly into the global ruleset. “clear” rules appearing in a dir-merged file do not affect the global ruleset. As we find dir-merged files in the transfer, their rules are prepended to their dir-merge chain so that a deeper directory's rules take precedence over its parent's rules.
When one of the above exclude/include modifiers are applied to “merge” or “dir-merge” rule, those modifiers are applied to the exclude/include rules within the file. The following modifiers may additionally be specified for merge rules:
| MODIFIER | DESCRIPTION |
| - | All rules within are exclude rules |
| + | All rules within are include rules |
| C | File processing should assume CVS-compatible parsing |
| e | Exclude the file's name from the transfer |
| n | Rules are not inherited by subdirectories |
| w | Rules are word-split instead of line-split |
The CVS-compatible modifier implies the ‘-’, ‘n’ and ‘w’ modifiers. If a filename is not supplied with it, then “.cvsignore” is used.
ENVIRONMENT
The following environment variables affect execution of
openrsync:
LOGNAME- This variable may also hold the username to use when connecting to an
rsync daemon. If
LOGNAMEis not set, then “nobody” will be used. USER- This variable holds the username to use when connecting to an rsync
daemon. If
USERis not set, thenLOGNAMEwill be used. RSYNC_RSH- This variable specifies the remote shell to use for remote connections.
The default remote shell is ssh(1) if neither
RSYNC_RSHnor--rshare specified. RSYNC_PASSWORD- This variable specifies the password to use when connecting to an rsync
daemon. It will be ignored if the
--password-fileoption is specified and passes the mode and owner check described above in the option's description. On many systems, environment variables are readable by other processes and should be considered insecure. Please prefer a password file instead.
EXIT STATUS
The openrsync utility exits 0 on success,
1 if an error occurs, or 2 if the remote protocol version is older than the
local protocol version.
EXAMPLES
A common invocation of openrsync is for
archiving from a remote host to the local computer:
% openrsync -av --delete remote:rpath
/local/pathThis will update the contents of /local/path/rpath with those on the remote server. Switching remote and local wil update the remote contents instead:
% openrsync -av --delete /local/path
remote:rpathAll examples use -t so that destination
files inherit the source time. If not changed, subsequent invocations of
openrsync will then consider the file up to date and
not transfer block hashes.
To update the out-of-date remote files host:dest/bar and host:dest/baz with the local ../src/bar and ../src/baz:
% openrsync -t ../src/bar ../src/baz
host:destTo update the out-of-date local files bar and baz with the remote files host:src/bar and host:src/baz:
% openrsync -t host:src/bar :src/baz
.To update the out-of-date local files ../dest/bar and ../dest/baz with bar and baz:
% openrsync -t bar baz
../destTo update the out-of-date remote files in
host:dest on a remote host running
openrsync with the local host running
rsync(1):
% rsync --rsync-path openrsync -t
../dest/* host:destSEE ALSO
STANDARDS
openrsync is compatible with rsync
protocol versions 27 - 29 as supported by the samba.org implementation of
rsync.
HISTORY
The openrsync utility has been available
since OpenBSD 6.5.
AUTHORS
The openrsync utility was written by
Kristaps Dzonsons
<kristaps@bsd.lv>.