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