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