Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / usr.bin / rdist / rdist.1
1 .\" Copyright (c) 1985, 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)rdist.1     8.3 (Berkeley) 3/17/94
33 .\" $FreeBSD: src/usr.bin/rdist/rdist.1,v 1.13.2.4 2001/12/21 10:07:20 ru Exp $
34 .\" $DragonFly: src/usr.bin/rdist/rdist.1,v 1.2 2003/06/17 04:29:30 dillon Exp $
35 .\"
36 .Dd March 17, 1994
37 .Dt RDIST 1
38 .Os
39 .Sh NAME
40 .Nm rdist
41 .Nd remote file distribution program
42 .Sh SYNOPSIS
43 .Nm
44 .Op Fl nqbRhivwyD
45 .Op Fl P Ar rshcmd
46 .Op Fl f Ar distfile
47 .Op Fl d Ar var=value
48 .Op Fl m Ar host
49 .Op Ar name ...\&
50 .Nm
51 .Op Fl nqbRhivwyD
52 .Op Fl P Ar rshcmd
53 .Fl c
54 .Ar name ...\&
55 .Oo Ar login Ns @ Oc Ns Xo
56 .Ar host Ns Op : Ns Ar dest
57 .Xc
58 .Sh DESCRIPTION
59 .Nm Rdist
60 is a program to maintain identical copies of files over multiple hosts.
61 It preserves the owner, group, mode, and mtime of files if possible and
62 can update programs that are executing.
63 .Nm Rdist
64 reads commands from
65 .Ar distfile
66 to direct the updating of files and/or directories.
67 .Pp
68 Options specific to the first SYNOPSIS form:
69 .Pp
70 .Bl -tag -width indent
71 .It Fl
72 If
73 .Ar distfile
74 is
75 .Sq Fl ,
76 the standard input is used.
77 .It Fl f Ar distfile
78 Use the specified
79 .Ar distfile .
80 .El
81 .Pp
82 If either the
83 .Fl f
84 or
85 .Sq Fl
86 option is not specified, the program looks first for
87 .Dq Pa distfile ,
88 then
89 .Dq Pa Distfile
90 to use as the input.
91 If no names are specified on the command line,
92 .Nm
93 will update all of the files and directories listed in
94 .Ar distfile  .
95 Otherwise, the argument is taken to be the name of a file to be updated
96 or the label of a command to execute.
97 If label and file names conflict,
98 it is assumed to be a label.
99 These may be used together to update specific files
100 using specific commands.
101 .Pp
102 Options specific to the second SYNOPSIS form:
103 .Pp
104 .Bl -tag -width Fl
105 .It Fl c
106 Forces
107 .Nm
108 to interpret the remaining arguments as a small
109 .Ar distfile  .
110 .Pp
111 The equivalent distfile is as follows.
112 .Pp
113 .Bd -ragged -offset indent -compact
114 .Pq Ar name ...\&
115 .Li ->
116 .Op Ar login Ns @
117 .Ar host
118 .Bd -ragged -offset indent -compact
119 .Li install
120 .Op Ar dest ;
121 .Ed
122 .Ed
123 .El
124 .Pp
125 Options common to both forms:
126 .Pp
127 .Bl -tag -width Ic
128 .It Fl P Ar rshcmd
129 Alternative program to provide
130 .Xr rsh 1 Ns -like
131 transport to the remote server.  It must provide a binary-transparent path
132 to the remote server, and must have a command argument syntax that is
133 compatible with
134 .Xr rsh 1 .
135 .It Fl d Ar var=value
136 Define
137 .Ar var
138 to have
139 .Ar value  .
140 The
141 .Fl d
142 option is used to define or override variable definitions in the
143 .Ar distfile  .
144 .Ar Value
145 can be the empty string, one name, or a list of names surrounded by
146 parentheses and separated by tabs and/or spaces.
147 .It Fl h
148 Follow symbolic links.
149 Copy the file that the link points to rather than the
150 link itself.
151 .It Fl i
152 Ignore unresolved links.
153 .Nm Rdist
154 will normally try to maintain the link structure of files being transferred
155 and warn the user if all the links cannot be found.
156 .It Fl m Ar host
157 Limit which machines are to be updated.
158 Multiple
159 .Fl m
160 arguments can be given to limit updates to a subset of the hosts listed in the
161 .Ar distfile  .
162 .It Fl n
163 Print the commands without executing them.
164 This option is
165 useful for debugging
166 .Ar distfile  .
167 .It Fl q
168 Quiet mode.
169 Files that are being modified are normally
170 printed on standard output.
171 The
172 .Fl q
173 option suppresses this.
174 .It Fl R
175 Remove extraneous files.
176 If a directory is being updated, any files that exist
177 on the remote host that do not exist in the master directory are removed.
178 This is useful for maintaining truly identical copies of directories.
179 .It Fl v
180 Verify that the files are up to date on all the hosts.
181 Any files
182 that are out of date will be displayed but no files will be changed
183 nor any mail sent.
184 .It Fl w
185 Whole mode.
186 The whole file name is appended to the destination directory
187 name.
188 Normally, only the last component of a name is used when renaming files.
189 This will preserve the directory structure of the files being
190 copied instead of flattening the directory structure.
191 For example,
192 renaming a list of files such as ( dir1/f1 dir2/f2 ) to dir3 would create
193 files dir3/dir1/f1 and dir3/dir2/f2 instead of dir3/f1 and dir3/f2.
194 .It Fl y
195 Younger mode.
196 Files are normally updated if their
197 .Ar mtime
198 and
199 .Ar size
200 (see
201 .Xr stat  2  )
202 disagree.
203 The
204 .Fl y
205 option causes
206 .Nm
207 not to update files that are younger than the master copy.
208 This can be used
209 to prevent newer copies on other hosts from being replaced.
210 A warning message is printed for files which are newer than the master copy.
211 .It Fl D
212 Debug mode.
213 .El
214 .Pp
215 .Ar Distfile
216 contains a sequence of entries that specify the files
217 to be copied, the destination hosts, and what operations to perform
218 to do the updating.
219 Each entry has one of the following formats.
220 .Pp
221 .Bd -literal -offset indent -compact
222 <variable name> `=' <name list>
223 [label:]<source list> `\->' <destination list> <command list>
224 [label:]<source list> `::' <time_stamp file> <command list>
225 .Ed
226 .Pp
227 The first format is used for defining variables.
228 The second format is used for distributing files to other hosts.
229 The third format is used for making lists of files that have been changed
230 since some given date.
231 The
232 .Ar source list
233 specifies a
234 list of files and/or directories on the local host which are to be used
235 as the master copy for distribution.
236 The
237 .Ar destination list
238 is the list of hosts to which these files are to be
239 copied.  Each file in the source list is added to a list of changes
240 if the file is out of date on the host which is being updated (second format) or
241 the file is newer than the time stamp file (third format).
242 .Pp
243 Labels are optional.
244 They are used to identify a command for partial updates.
245 .Pp
246 Newlines, tabs, and blanks are only used as separators and are
247 otherwise ignored.
248 Comments begin with `#' and end with a newline.
249 .Pp
250 Variables to be expanded begin with `$' followed by one character or
251 a name enclosed in curly braces (see the examples at the end).
252 .Pp
253 The source and destination lists have the following format:
254 .Bd -literal -offset indent
255 <name>
256 .Ed
257 or
258 .Bd -literal -offset indent -compact
259 `(' <zero or more names separated by white-space> `)'
260 .Ed
261 .Pp
262 The shell meta-characters `[', `]', `{', `}', `*', and `?'
263 are recognized and expanded (on the local host only) in the same way as
264 .Xr csh  1  .
265 They can be escaped with a backslash.
266 The `~' character is also expanded in the same way as
267 .Xr csh 1
268 but is expanded separately on the local and destination hosts.
269 When the
270 .Fl w
271 option is used with a file name that begins with `~', everything except the
272 home directory is appended to the destination name.
273 File names which do not begin with `/' or `~' use the destination user's
274 home directory as the root directory for the rest of the file name.
275 .Pp
276 The command list consists of zero or more commands of the following
277 format.
278 .Bd -ragged -offset indent -compact
279 .Bl -column except_patx pattern\ listx
280 .It "`install'  <options>       opt_dest_name `;'
281 .It "`notify'   <name list>     `;'
282 .It "`except'   <name list>     `;'
283 .It "`except_pat'       <pattern list>  `;'
284 .It "`special'  <name list>     string `;'
285 .El
286 .Ed
287 .Pp
288 The
289 .Ic install
290 command is used to copy out of date files and/or directories.
291 Each source file is copied to each host in the destination list.
292 Directories are recursively copied in the same way.
293 .Ar Opt_dest_name
294 is an optional parameter to rename files.
295 If no
296 .Ic install
297 command appears in the command list or
298 the destination name is not specified,
299 the source file name is used.
300 Directories in the path name will be created if they
301 do not exist on the remote host.
302 To help prevent disasters, a non-empty directory on a target host will
303 never be replaced with a regular file or a symbolic link.
304 However, under the `\-R' option a non-empty directory will be removed
305 if the corresponding filename is completely absent on the master host.
306 The
307 .Ar options
308 are `\-R', `\-h', `\-i', `\-v', `\-w', `\-y', and `\-b'
309 and have the same semantics as
310 options on the command line except they only apply to the files
311 in the source list.
312 The login name used on the destination host is the same as the local host
313 unless the destination name is of the format ``login@host".
314 .Pp
315 The
316 .Ic notify
317 command is used to mail the list of files updated (and any errors
318 that may have occurred) to the listed names.
319 If no `@' appears in the name, the destination host is appended to
320 the name
321 (e.g., name1@host, name2@host, ...).
322 .Pp
323 The
324 .Ic except
325 command is used to update all of the files in the source list
326 .Ic except
327 for the files listed in
328 .Ar name list  .
329 This is usually used to copy everything in a directory except certain files.
330 .Pp
331 The
332 .Ic except_pat
333 command is like the
334 .Ic except
335 command except that
336 .Ar pattern list
337 is a list of regular expressions
338 (see
339 .Xr re_format 7
340 for details).
341 If one of the patterns matches some string within a file name, that file will
342 be ignored.
343 Note that since `\e' is a quote character, it must be doubled to become
344 part of the regular expression.  Variables are expanded in
345 .Ar pattern list
346 but not shell file pattern matching characters.  To include a `$', it
347 must be escaped with `\e'.
348 .Pp
349 The
350 .Ic special
351 command is used to specify
352 .Xr sh  1
353 commands that are to be executed on the
354 remote host after the file in
355 .Ar name list
356 is updated or installed.
357 If the
358 .Ar name list
359 is omitted then the shell commands will be executed
360 for every file updated or installed.  The shell variable `FILE' is set
361 to the current filename before executing the commands in
362 .Ar string  .
363 .Ar String
364 starts and ends with `"' and can cross multiple lines in
365 .Ar distfile .
366 Multiple commands to the shell should be separated by `;'.
367 Commands are executed in the user's home directory on the host
368 being updated.
369 The
370 .Ar special
371 command can be used to rebuild private databases, etc.
372 after a program has been updated.
373 .Pp
374 The following is a small example:
375 .Bd -literal -offset indent
376 HOSTS = ( matisse root@arpa )
377
378 FILES = ( /bin /lib /usr/bin /usr/games
379 \t/usr/include/{*.h,{stand,sys,vax*,pascal,machine}/*.h}
380 \t/usr/lib /usr/man/man? /usr/ucb /usr/local/rdist )
381
382 EXLIB = ( Mail.rc aliases aliases.dir aliases.pag crontab dshrc
383 \tsendmail.cf sendmail.fc sendmail.hf sendmail.st uucp vfont )
384
385 ${FILES} -> ${HOSTS}
386 \tinstall -R ;
387 \texcept /usr/lib/${EXLIB} ;
388 \texcept /usr/games/lib ;
389 \tspecial /usr/lib/sendmail "/usr/lib/sendmail -bz" ;
390
391 srcs:
392 /usr/src/bin -> arpa
393 \texcept_pat ( \e\e.o\e$ /SCCS\e$ ) ;
394
395 IMAGEN = (ips dviimp catdvi)
396
397 imagen:
398 /usr/local/${IMAGEN} -> arpa
399 \tinstall /usr/local/lib ;
400 \tnotify ralph ;
401
402 ${FILES} :: stamp.cory
403 \tnotify root@cory ;
404 .Ed
405 .Sh FILES
406 .Bl -tag -width /tmp/rdist* -compact
407 .It Pa distfile
408 input command file
409 .It Pa /tmp/rdist*
410 temporary file for update lists
411 .El
412 .Sh SEE ALSO
413 .Xr csh 1 ,
414 .Xr sh 1 ,
415 .Xr stat 2 ,
416 .Xr re_format 7
417 .Sh HISTORY
418 The
419 .Nm
420 command appeared in
421 .Bx 4.3 .
422 .Sh DIAGNOSTICS
423 A complaint about mismatch of
424 .Nm
425 version numbers may really stem
426 from some problem with starting your shell, e.g., you are in too many groups.
427 .Pp
428 .Nm Rdist
429 relies on
430 .Xr rcmd 3
431 type remote services executing successfully and in silence.
432 A common error is for non-interactive initialization scripts, like
433 .Pa .cshrc ,
434 to generate output (or to run other programs which generate output
435 when not attached to a terminal -- the most frequent offender is
436 .Xr stty 1 ) .
437 This extra output will cause
438 .Nm
439 to fail with the error message:
440 .Pp
441 .Dl rdist: connection failed: version numbers don't match
442 .Sh BUGS
443 Source files must reside on the local host where
444 .Nm
445 is executed.
446 .Pp
447 There is no easy way to have a
448 .Ic special
449 command executed after all files
450 in a directory have been updated.
451 .Pp
452 Variable expansion only works for name lists; there should be a general macro
453 facility.
454 .Pp
455 .Nm Rdist
456 aborts on files which have a negative mtime (before Jan 1, 1970).
457 .Pp
458 There should be a `force' option to allow replacement of non-empty directories
459 by regular files or symlinks.  A means of updating file modes and owners
460 of otherwise identical files is also needed.