OPENRSYNC(1)

NAME
openrsync - synchronise local and remote files

SYNOPSIS
openrsync [-aDgIJlnOoprtVvx] [-e program] [--address=sourceaddr] [--compare-dest=directory] [--contimeout=seconds] [--del] [--exclude pattern] [--exclude-from=file] [--include pattern] [--include-from=file] [--max-size=size] [--min-size=size] [--no-motd] [--numeric-ids] [--port=service] [--rsync-path=program] [--size-only] [--timeout=seconds] source ... directory

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:

-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.

--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-dest directories may be provided. If directory is a relative path, it is relative to the destination directory.

--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.

-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.

-e program, --rsh=program
    Specify alternative communication program, defaults to ssh(1).

--exclude pattern
    Exclude files matching pattern.

--exclude-from=file
    Load patterns and rules from file.

--devices
    Also transfer device files.

-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-ids is also given or if the remote group name is unknown on the local machine, set the numeric group ID to match the source instead.

-I, --ignore-times
    Do not skip based on file size and modification time.

--include pattern
    Include files matching pattern.

--include-from=file
    Load patterns and rules from file.

-J, --omit-link-times
    Don't set symlink modification times to match the source.

-l, --links
    Also transfer symbolic links. The link is transferred as a standalone file: if the destination does not exist, it will be broken.

--max-size size
    Don't transfer any file that is larger than size bytes. Alternatively size may instead use a multiplier, as documented in scan_scaled(3), to specify the size.

--min-size size
    Don't transfer any file that is smaller than size bytes. See --max-size on the definition of size.

-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 -g or -o is also given.

-O, --omit-dir-times
    Don't set directory modification times to match the source.

-o, --owner
    Set the user name to match the source, with similar matching logic as for -g. If --numeric-ids is 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, --perms
    Set destination file or directory permissions to match the source when it is updated.

--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”.

-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.

--rsync-path=program
    Run program on the remote host instead of the default rsync.

--size-only
    Skip files based only on size, don't check timestamp.

--specials
    Also transfer fifo and unix domain socket files.

--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.

-V, --version
    Print version and exit.

-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  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.

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.

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/path

This 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:rpath

All 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:dest

To 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 ../dest

To 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:dest

SEE ALSO
ssh(1)

STANDARDS
openrsync is compatible with rsync protocol version 27 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>.