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