Annotation of src/usr.bin/rsync/rsync.1, Revision 1.25.2.1
1.25.2.1! benno 1: .\" $OpenBSD: rsync.1,v 1.25 2021/08/30 20:25:24 job Exp $
1.1 benno 2: .\"
3: .\" Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
4: .\"
5: .\" Permission to use, copy, modify, and distribute this software for any
6: .\" purpose with or without fee is hereby granted, provided that the above
7: .\" copyright notice and this permission notice appear in all copies.
8: .\"
9: .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10: .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11: .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12: .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13: .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14: .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15: .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16: .\"
1.25.2.1! benno 17: .Dd $Mdocdate: October 29 2021 $
1.12 schwarze 18: .Dt OPENRSYNC 1
1.1 benno 19: .Os
20: .Sh NAME
1.11 jmc 21: .Nm openrsync
1.1 benno 22: .Nd synchronise local and remote files
23: .Sh SYNOPSIS
1.12 schwarze 24: .Nm openrsync
1.17 bket 25: .Op Fl aDglnoprtvx
1.10 jmc 26: .Op Fl e Ar program
1.21 deraadt 27: .Op Fl -address Ns = Ns Ar sourceaddr
1.25.2.1! benno 28: .Op Fl -compare-dest Ns = Ns Ar directory
1.13 naddy 29: .Op Fl -del
1.25 job 30: .Op Fl -exclude Ar pattern
31: .Op Fl -exclude-from Ns = Ns Ar file
32: .Op Fl -include Ar pattern
33: .Op Fl -include-from Ns = Ns Ar file
1.25.2.1! benno 34: .Op Fl -max-size Ns = Ns size
! 35: .Op Fl -min-size Ns = Ns size
1.24 jmc 36: .Op Fl -no-motd
1.16 schwarze 37: .Op Fl -numeric-ids
38: .Op Fl -port Ns = Ns Ar service
1.10 jmc 39: .Op Fl -rsync-path Ns = Ns Ar program
1.22 claudio 40: .Op Fl -timeout Ns = Ns Ar seconds
1.10 jmc 41: .Op Fl -version
1.1 benno 42: .Ar source ...
43: .Ar directory
44: .Sh DESCRIPTION
45: The
46: .Nm
47: utility synchronises files in the destination
48: .Ar directory
49: with one or more
50: .Ar source
51: files.
52: Either the
53: .Ar source
54: or the destination
55: .Ar directory
56: may be remote,
57: but not both.
58: The arguments are as follows:
59: .Bl -tag -width Ds
1.14 schwarze 60: .It Fl a , -archive
1.6 florian 61: Shorthand for
1.10 jmc 62: .Fl Dgloprt .
1.21 deraadt 63: .It Fl -address Ns = Ns Ar sourceaddr
64: When connecting to an rsync daemon, use
65: .Ar sourceaddr
66: as the source address for connections, which is useful on machines with
67: multiple interfaces.
1.25.2.1! benno 68: .It Fl -compare-dest Ns = Ns Ar directory
! 69: Use directory as an alternate base directory to compare files against on the
! 70: destination machine.
! 71: If file in
! 72: .Ar directory
! 73: is found and identical to the sender's file, the file will not be transferred.
! 74: Multiple
! 75: .Fl -compare-dest
! 76: directories may be provided.
! 77: If
! 78: .Ar directory
! 79: is a relative path, it is relative to the destination directory.
1.6 florian 80: .It Fl D
1.16 schwarze 81: Also transfer device and special files.
1.6 florian 82: Shorthand for
1.16 schwarze 83: .Fl -devices -specials .
1.13 naddy 84: .It Fl -del , -delete
1.10 jmc 85: Delete files in
86: .Ar directory
87: not found in
88: .Ar source
89: directories.
90: Only applicable with
91: .Fl r .
1.25 job 92: .It Fl -exclude Ar pattern
93: Exclude files matching
94: .Em pattern .
95: .It Fl -exclude-from Ns = Ns Ar file
96: Load
97: .Em patterns
98: and
99: .Em rules
100: from
101: .Em file .
102: .It Fl -include Ar pattern
103: Include files matching
104: .Em pattern .
105: .It Fl -include-from Ns = Ns Ar file
106: Load
107: .Em patterns
108: and
109: .Em rules
110: from
111: .Em file .
1.6 florian 112: .It Fl -devices
1.16 schwarze 113: Also transfer device files.
1.10 jmc 114: .It Fl e Ar program , Fl -rsh Ns = Ns Ar program
1.16 schwarze 115: Specify alternative communication program, defaults to
1.8 deraadt 116: .Xr ssh 1 .
1.14 schwarze 117: .It Fl g , -group
1.16 schwarze 118: Set the group name to match the source.
119: For example, group
1.3 benno 120: .Qq kristaps
1.16 schwarze 121: with ID 1000 on a remote server is matched to group
1.3 benno 122: .Qq kristaps
1.16 schwarze 123: on the local machine with ID 2000.
124: If
125: .Fl -numeric-ids
126: is also given or if the remote group name is unknown on the local machine,
127: set the numeric group ID to match the source instead.
1.14 schwarze 128: .It Fl l , -links
1.16 schwarze 129: Also transfer symbolic links.
1.1 benno 130: The link is transferred as a standalone file: if the destination does
131: not exist, it will be broken.
1.25.2.1! benno 132: .It Fl -max-size Ar size
! 133: Don't transfer any file that is larger than
! 134: .Ar size
! 135: bytes.
! 136: Alternatively
! 137: .Ar size
! 138: may instead use a multiplier, as documented in
! 139: .Xr scan_scaled 3 ,
! 140: to specify the size.
! 141: .It Fl -min-size Ar size
! 142: Don't transfer any file that is smaller than
! 143: .Ar size
! 144: bytes.
! 145: See
! 146: .Fl -max-size
! 147: on the definiton of size.
1.14 schwarze 148: .It Fl n , -dry-run
1.16 schwarze 149: Do not actually modify the destination.
150: Mainly useful in combination with
151: .Fl v .
1.23 job 152: .It Fl -no-motd
153: Do not display the Message of the Day.
1.16 schwarze 154: .It Fl -numeric-ids
155: Ignore user and group names, use numeric user and group IDs only.
156: Has no effect unless
157: .Fl g
158: or
159: .Fl o
160: is also given.
1.14 schwarze 161: .It Fl o , -owner
1.16 schwarze 162: Set the user name to match the source, with similar matching logic as for
163: .Fl g .
164: If
165: .Fl -numeric-ids
166: is also given or if the remote user name is unknown on the local machine,
167: set the numeric user ID to match the source instead.
168: Only works if run as root.
1.14 schwarze 169: .It Fl p , -perms
1.1 benno 170: Set destination file or directory permissions to match the source when
171: it is updated.
1.16 schwarze 172: .It Fl -port Ns = Ns Ar service
173: Specify an alternative TCP port number.
174: The
175: .Ar service
176: can be given as a decimal integer or as a name to be looked up in the
177: .Xr services 5
178: database.
179: The default is
180: .Dq rsync .
1.14 schwarze 181: .It Fl r , -recursive
1.1 benno 182: If
183: .Ar source
184: designates a directory, synchronise the directory and the entire subtree
185: connected at that point.
186: If
187: .Ar source
1.16 schwarze 188: ends with a slash, only the subtree is synchronised, not the
189: .Ar source
190: directory itself.
1.1 benno 191: If
192: .Ar source
193: is a file, this has no effect.
1.10 jmc 194: .It Fl -rsync-path Ns = Ns Ar program
195: Run
1.16 schwarze 196: .Ar program
1.10 jmc 197: on the remote host instead of the default
1.16 schwarze 198: .Pa rsync .
1.6 florian 199: .It Fl -specials
1.16 schwarze 200: Also transfer fifo and unix domain socket files.
1.22 claudio 201: .It Fl -timeout Ns = Ns Ar seconds
202: Set the I/O timeout in seconds.
203: Exit if no data was transferred for the specified time.
204: The default is 0, which means no timeout.
1.14 schwarze 205: .It Fl t , -times
1.1 benno 206: Set destination file and directory modification time to match the source
207: when it is updated or created.
1.14 schwarze 208: .It Fl v , -verbose
1.1 benno 209: Increase verbosity.
210: Specify once for files being transferred, twice for specific status,
211: thrice for per-file transfer information, and four times for per-file
212: breakdowns.
1.17 bket 213: .It Fl x
214: Do not cross filesystem boundaries.
215: If this option is repeated, all mount point directories from the copy are
216: omitted.
217: Otherwise, it includes an empty directory at each mount point it encounters.
1.5 deraadt 218: .It Fl -version
219: Print version and exit.
1.1 benno 220: .El
221: .Pp
222: A remote
223: .Ar source
224: or
225: .Ar directory
1.16 schwarze 226: has the syntax
227: .Ar host : Ns Ar path
1.1 benno 228: for connecting via
229: .Xr ssh 1 ,
230: or
1.16 schwarze 231: .Cm rsync Ns :// Ns Ar host Ns / Ns Ar path
1.1 benno 232: or
1.16 schwarze 233: .Ar host Ns :: Ns Ar path
1.1 benno 234: for connecting to a remote daemon.
235: Subsequent to the first remote
236: .Ar source ,
237: the host may be dropped to become just
1.16 schwarze 238: .Pf : Ar path
1.1 benno 239: or
1.16 schwarze 240: .Pf :: Ar path .
1.1 benno 241: .Pp
242: For connecting to a remote daemon with
1.16 schwarze 243: .Cm rsync Ns :// Ns Ar host
1.1 benno 244: or
1.16 schwarze 245: .Ar host Ns :: Ns Ar path ,
1.1 benno 246: the first path component is interpreted as a
247: .Qq module :
1.16 schwarze 248: .Ar host Ns :: Ns Ar module Ns / Ns Ar path .
1.1 benno 249: This only applies to the first
250: .Ar source
251: invocation; subsequent to that, the module should not be specified.
252: .Pp
253: By default, new destination files and directories are given the current
254: time and the source file permissions.
255: Updated files retain their existing permissions.
256: It is an error if updated files have their file types change (e.g.,
257: updating a directory with a file).
258: .Pp
259: At this time,
260: .Ar source
261: may only consist of regular files, directories
262: .Pq only with Fl r ,
263: or symbolic links
264: .Pq only with Fl l .
265: The destination
266: .Ar directory
267: must be a directory and is created if not found.
1.25 job 268: .\" .Sh PATTERNS AND RULES
1.1 benno 269: .\" .Sh ENVIRONMENT
270: .\" .Sh FILES
1.16 schwarze 271: .Sh EXIT STATUS
272: The
273: .Nm
274: utility exits 0 on success, 1 if an error occurs, or 2 if the remote
275: protocol version is older than the local protocol version.
1.1 benno 276: .Sh EXAMPLES
277: All examples use
278: .Fl t
279: so that destination files inherit the source time.
280: If not changed, subsequent invocations of
281: .Nm
282: will then consider the file up to date and not transfer block hashes.
283: .Pp
284: To update the out-of-date remote files
285: .Pa host:dest/bar
286: and
287: .Pa host:dest/baz
288: with the local
289: .Pa ../src/bar
290: and
291: .Pa ../src/baz :
292: .Pp
293: .Dl % rsync -t ../src/bar ../src/baz host:dest
294: .Pp
295: To update the out-of-date local files
296: .Pa bar
297: and
298: .Pa baz
299: with the remote files
300: .Pa host:src/bar
301: and
302: .Pa host:src/baz :
303: .Pp
304: .Dl % rsync -t host:src/bar :src/baz \&.
305: .Pp
306: To update the out-of-date local files
307: .Pa ../dest/bar
308: and
309: .Pa ../dest/baz
310: with
311: .Pa bar
312: and
313: .Pa baz :
314: .Pp
315: .Dl % rsync -t bar baz ../dest
316: .\" .Sh DIAGNOSTICS
317: .Sh SEE ALSO
1.20 schwarze 318: .Xr ssh 1
1.16 schwarze 319: .Sh STANDARDS
320: .Nm
321: is compatible with rsync protocol version 27
322: as supported by the samba.org implementation of rsync.
323: .Sh HISTORY
324: The
325: .Nm
326: utility has been available since
327: .Ox 6.5 .
328: .Sh AUTHORS
329: The
330: .Nm
331: utility was written by
332: .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
1.1 benno 333: .\" .Sh CAVEATS
334: .\" .Sh BUGS