Annotation of src/usr.bin/rdist/rdist.1, Revision 1.15
1.15 ! deraadt 1: .\" $OpenBSD: rdist.1,v 1.14 2002/05/10 02:01:32 millert Exp $
1.2 dm 2: .\"
3: .\" Copyright (c) 1983 Regents of the University of California.
4: .\" All rights reserved.
1.1 deraadt 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: .\"
1.6 millert 34: .\" $From: rdist.man,v 6.34 1996/01/29 22:37:19 mcooper Exp $
1.2 dm 35: .\" @(#)rdist.1 6.6 (Berkeley) 5/13/86
1.1 deraadt 36: .\"
1.14 millert 37: .Dd May 9, 2002
38: .Dt RDIST 1
39: .Os
40: .Sh NAME
41: .Nm rdist
42: .Nd remote file distribution client program
43: .Sh SYNOPSIS
44: .Nm rdist
1.15 ! deraadt 45: .Bk -words
1.14 millert 46: .Op Fl DFn
47: .Op Fl A Ar num
48: .Op Fl a Ar num
49: .Op Fl d Ar var=value
50: .Op Fl l Ar <local logopts>
51: .Op Fl L Ar <remote logopts>
52: .Op Fl f Ar distfile
53: .Op Fl M Ar maxproc
54: .Op Fl m Ar host
55: .Op Fl o Ar distopts
56: .Op Fl t Ar timeout
57: .Op Fl p Ar <rdistd-path>
58: .Op Fl P Ar <rsh-path>
59: .Op Ar name ...
1.15 ! deraadt 60: .Ek
1.14 millert 61: .Pp
62: .Nm rdist
63: .Fl DFn
64: .Fl c Ar name ...
65: .Ar [login@]host[:dest]
66: .Pp
67: .Nm rdist
68: .Fl Server
69: .Pp
70: .Nm rdist
71: .Fl V
72: .Sh DESCRIPTION
73: .Nm
1.8 aaron 74: is a program to maintain identical copies of files over multiple hosts.
1.1 deraadt 75: It preserves the owner, group, mode, and mtime of files if possible and
76: can update programs that are executing.
1.14 millert 77: .Nm
1.1 deraadt 78: reads commands from
1.14 millert 79: .Pa distfile
1.1 deraadt 80: to direct the updating of files and/or directories.
81: If
1.14 millert 82: .Pa distfile
83: is
84: .Sq - ,
85: the standard input is used.
1.2 dm 86: If no
1.14 millert 87: .Fl f
88: option is present, the program looks first for
89: .Pa distfile ,
90: then
91: .Pa Distfile
92: to use as the input.
1.1 deraadt 93: If no names are specified on the command line,
1.14 millert 94: .Nm
1.1 deraadt 95: will update all of the files and directories listed in
1.14 millert 96: .Pa distfile .
1.1 deraadt 97: Otherwise, the argument is taken to be the name of a file to be updated
1.14 millert 98: or the label of a command to execute.
99: If label and file names conflict, it is assumed to be a label.
100: These may be used together to update specific files using specific commands.
101: .Pp
1.2 dm 102: The
1.14 millert 103: .Fl c
1.2 dm 104: option forces
1.14 millert 105: .Nm
1.1 deraadt 106: to interpret the remaining arguments as a small
1.14 millert 107: .Pa distfile .
1.1 deraadt 108: The equivalent distfile is as follows.
1.14 millert 109: .Bd -literal -offset indent
1.2 dm 110: ( \fIname\fP ... ) -> [\fIlogin\fP@]\fIhost\fP
1.14 millert 111: install [\fIdest\fP] ;
112: .Ed
113: .Pp
1.2 dm 114: The
1.14 millert 115: .Fl Server
1.2 dm 116: option is recognized to provide partial backward compatible support
117: for older versions of
1.14 millert 118: .Nm
1.2 dm 119: which used this option to put
1.14 millert 120: .Nm
1.2 dm 121: into server mode.
122: If
1.14 millert 123: .Nm
1.8 aaron 124: is started with the
1.14 millert 125: .Fl Server
1.2 dm 126: command line option, it will attempt to exec (run) the old version of
1.14 millert 127: .Nm rdist ,
128: .Pa /usr/bin/oldrdist .
129: .Pp
130: .Nm
1.13 millert 131: uses a remote shell command to access each target host.
132: By default,
1.14 millert 133: .Xr ssh 1
1.13 millert 134: is used, unless overridden by the
1.14 millert 135: .Fl P
136: option or the
137: .Ev RSH
138: environment variable.
1.13 millert 139: If the target host is the string
1.14 millert 140: .Em localhost
141: and the remote user name is the same as the local user name,
142: .Nm
1.2 dm 143: will run the command
1.14 millert 144: .Bd -literal -offset indent
145: /bin/sh -c rdistd -S
146: .Ed
147: .Pp
148: Otherwise,
149: .Nm
1.2 dm 150: run will run the command
1.14 millert 151: .Bd -literal -offset indent
1.13 millert 152: \fBssh \fIhost\fB -l \fIremuser \fBrdistd -S\fR
1.14 millert 153: .Ed
154: .Pp
1.8 aaron 155: where
1.14 millert 156: .Em host
1.2 dm 157: is the name of the target host,
1.14 millert 158: .Em remuser
1.15 ! deraadt 159: is the name of the user to make the connection as, and
1.14 millert 160: .Em rdistd
1.2 dm 161: is the rdist server command on the target host as shown below.
1.14 millert 162: .Pp
1.2 dm 163: On each target host
1.14 millert 164: .Nm
1.2 dm 165: will attempt to run the command
1.14 millert 166: .Bd -literal -offset indent
167: rdistd -S
168: .Ed
169: .Pp
1.2 dm 170: or
1.14 millert 171: .Bd -literal -offset indent
172: <rdistd path> -S
173: .Ed
174: .Pp
1.2 dm 175: if the
1.14 millert 176: .Fl p
1.2 dm 177: option was specified.
178: If no
1.14 millert 179: .Fl p
180: option is included, or the
181: .Ar <rdistd path>
1.2 dm 182: is a simple filename,
1.14 millert 183: .Em rdistd
1.2 dm 184: or
1.14 millert 185: .Em <rdistd path>
1.8 aaron 186: must be somewhere in the
1.14 millert 187: .Ev PATH
1.2 dm 188: of the user running
1.14 millert 189: .Nm
1.2 dm 190: on the remote (target) host.
1.14 millert 191: .Pp
192: The options are as follows:
193: .Bl -tag -width Ds
194: .It Fl A Ar num
1.2 dm 195: Set the minimum number of free files (inodes) on a filesystem that must exist
1.8 aaron 196: for
1.14 millert 197: .Nm
1.2 dm 198: to update or install a file.
1.14 millert 199: .It Fl a Ar num
1.2 dm 200: Set the minimum amount of free space (in bytes) on a filesystem that must exist
1.8 aaron 201: for
1.14 millert 202: .Nm
1.2 dm 203: to update or install a file.
1.14 millert 204: .It Fl D
1.2 dm 205: Enable copious debugging messages.
1.14 millert 206: .It Fl d Ar var=value
1.1 deraadt 207: Define
1.14 millert 208: .Ar var
1.1 deraadt 209: to have
1.14 millert 210: .Ar value .
1.2 dm 211: This
1.1 deraadt 212: option is used to define or override variable definitions in the
1.14 millert 213: .Pa distfile .
214: .Ar value
1.1 deraadt 215: can be the empty string, one name, or a list of names surrounded by
216: parentheses and separated by tabs and/or spaces.
1.14 millert 217: .It Fl F
1.8 aaron 218: Do not fork any child
1.14 millert 219: .Nm
1.2 dm 220: processes.
221: All clients are updated sequentially.
1.14 millert 222: .It Fl f Ar distfile
1.2 dm 223: Set the name of the distfile to use to be
1.14 millert 224: .Ar distfile .
1.8 aaron 225: If
1.14 millert 226: .Ar distfile
1.2 dm 227: is specified as
1.14 millert 228: .Dq -
229: (dash) then read from standard input (stdin).
230: .It Fl l Ar logopts
1.2 dm 231: Set local logging options.
1.8 aaron 232: See the section
1.14 millert 233: .Sy MESSAGE LOGGING
1.2 dm 234: for details on the syntax for
1.14 millert 235: .Ar logopts .
236: .It Fl L Ar logopts
1.2 dm 237: Set remote logging options.
1.14 millert 238: .Ar logopts
239: is the same as for local logging except the values are passed to the remote
1.2 dm 240: server (\fIrdistd\fR).
1.8 aaron 241: See the section
1.14 millert 242: .Sy MESSAGE LOGGING
1.2 dm 243: for details on the syntax for
1.14 millert 244: .Ar logopts .
245: .It Fl M Ar num
246: Set the maximum number of simultaneously running child
247: .Nm
1.2 dm 248: processes to
1.14 millert 249: .Ar num .
1.2 dm 250: The default is 4.
1.14 millert 251: .It Fl m Ar machine
1.1 deraadt 252: Limit which machines are to be updated. Multiple
1.14 millert 253: .Fl m
1.1 deraadt 254: arguments can be given to limit updates to a subset of the hosts listed in the
1.14 millert 255: .Pa distfile .
256: .It Fl n
257: Print the commands without executing them.
258: This option is useful for debugging a
259: .Pa distfile .
260: .It Fl o Ns Ar distopts
1.2 dm 261: Specify the dist options to enable.
1.14 millert 262: .Ar distopts
1.2 dm 263: is a comma separated list of options which are listed below.
264: The valid values for
1.14 millert 265: .Ar distopts
1.2 dm 266: are:
1.14 millert 267: .Bl -tag -width Ds
268: .It Sy verify
269: Verify that the files are up to date on all the hosts.
270: Any files that are out of date will be displayed but no files will be
271: changed nor will any mail be sent.
272: .It Sy whole
273: Whole mode.
274: The whole file name is appended to the destination directory name.
275: Normally, only the last component of a name is used when renaming files.
1.1 deraadt 276: This will preserve the directory structure of the files being
1.14 millert 277: copied instead of flattening the directory structure.
278: For example, rdisting a list of files such as
279: .Pa /path/dir1/f1
1.2 dm 280: and
1.14 millert 281: .Pa /path/dir2/f2
1.8 aaron 282: to
1.14 millert 283: .Pa /tmp/dir
284: would create files
285: .Pa /tmp/dir/path/dir1/f1
1.8 aaron 286: and
1.14 millert 287: .Pa /tmp/dir/path/dir2/f2
1.8 aaron 288: instead of
1.14 millert 289: .Pa /tmp/dir/dir1/f1
1.8 aaron 290: and
1.14 millert 291: .Pa /tmp/dir/dir2/f2 .
292: .It Sy noexec
1.8 aaron 293: Automatically exclude executable files that are in
1.14 millert 294: .Xr a.out 5
1.8 aaron 295: format from being checked or updated.
1.14 millert 296: .It Sy younger
297: Younger mode.
298: Files are normally updated if their
299: .Em mtime
1.1 deraadt 300: and
1.14 millert 301: .Em size
1.1 deraadt 302: (see
1.14 millert 303: .Xr stat 2 )
304: disagree.
305: This option causes
306: .Nm
1.1 deraadt 307: not to update files that are younger than the master copy.
1.14 millert 308: This can be used to prevent newer copies on other hosts from being replaced.
1.1 deraadt 309: A warning message is printed for files which are newer than the master copy.
1.14 millert 310: .It Sy compare
311: Binary comparison.
312: Perform a binary comparison and update files if they differ rather than
313: comparing dates and sizes.
314: .It Sy follow
315: Follow symbolic links.
316: Copy the file that the link points to rather than the link itself.
317: .It Sy ignlnks
1.2 dm 318: Ignore unresolved links.
1.14 millert 319: .Nm
1.2 dm 320: will normally try to maintain the link structure of files being transferred
321: and warn the user if all the links cannot be found.
1.14 millert 322: .It Sy chknfs
323: Do not check or update files on target host that reside on NFS filesystems.
324: .It Sy chkreadonly
325: Enable check on target host to see if a file resides on a read-only filesystem.
1.2 dm 326: If a file does, then no checking or updating of the file is attempted.
1.14 millert 327: .It Sy chksym
1.2 dm 328: If the target on the remote host is a symbolic link, but is not on the
329: master host, the remote target will be left a symbolic link.
330: This behavior is generally considered a bug in the original version of
1.14 millert 331: .Nm rdist ,
1.2 dm 332: but is present to allow compatibility with older versions.
1.14 millert 333: .It Sy quiet
334: Quiet mode.
335: Files that are being modified are normally printed on standard output.
336: This option suppresses that.
337: .It Sy remove
338: Remove extraneous files.
339: If a directory is being updated, any files that exist on the remote host
340: that do not exist in the master directory are removed.
1.2 dm 341: This is useful for maintaining truly identical copies of directories.
1.14 millert 342: .It Sy nochkowner
1.2 dm 343: Do not check user ownership of files that already exist.
344: The file ownership is only set when the file is updated.
1.14 millert 345: .It Sy nochkgroup
1.2 dm 346: Do not check group ownership of files that already exist.
347: The file ownership is only set when the file is updated.
1.14 millert 348: .It Sy nochkmode
1.2 dm 349: Do not check file and directory permission modes.
350: The permission mode is only set when the file is updated.
1.14 millert 351: .It Sy nodescend
1.2 dm 352: Do not descend into a directory.
1.14 millert 353: Normally,
354: .Nm
1.2 dm 355: will recursively check directories.
1.14 millert 356: If this option is enabled, then any files listed in the file list in the
357: distfile that are directories are not recursively scanned.
1.2 dm 358: Only the existence, ownership, and mode of the directory are checked.
1.14 millert 359: .It Sy numchkgroup
1.9 aaron 360: Use the numeric group ID (GID) to check group ownership instead of
1.2 dm 361: the group name.
1.14 millert 362: .It Sy numchkowner
1.9 aaron 363: Use the numeric user ID (UID) to check user ownership instead of
1.2 dm 364: the user name.
1.14 millert 365: .It Sy savetargets
1.2 dm 366: Save files that are updated instead of removing them.
1.15 ! deraadt 367: Any target file that is updated is first renamed from
1.14 millert 368: .Pa file
1.2 dm 369: to
1.14 millert 370: .Pa file.OLD .
371: .It Sy sparse
372: Enable checking for sparse (aka
373: .Dq wholely )
374: files.
375: One of the most common types of sparse files are those produced by
376: .Xr db 3 .
1.3 dm 377: This option adds some additional processing overhead so it should
378: only be enabled for targets likely to contain sparse files.
1.14 millert 379: .El
380: .It Fl p Ar <rdistd-path>
1.2 dm 381: Set the path where the rdistd server is searched for on the target host.
1.14 millert 382: .It Fl P Ar <rsh-path>
383: Set the path to the remote shell command.
1.2 dm 384: The
385: .I rsh-path
1.7 deraadt 386: may be a colon separated list of possible pathnames.
1.2 dm 387: In this case, the first component of the path to exist is used.
1.14 millert 388: e.g.,
389: .Pa "/usr/bin/ssh:/usr/bin/rsh" ,
390: .Pa /usr/bin/ssh .
391: .It Fl t Ar timeout
1.8 aaron 392: Set the timeout period (in seconds) for waiting for responses from the remote
1.14 millert 393: .Nm
1.2 dm 394: server.
395: The default is 900 seconds.
1.14 millert 396: .It Fl V
1.2 dm 397: Print version information and exit.
1.14 millert 398: .Sh MESSAGE LOGGING
399: .Nm
1.2 dm 400: uses a collection of predefined message
1.14 millert 401: .Em facilities
1.2 dm 402: that each contain a list of message
1.14 millert 403: .Sy types
1.8 aaron 404: specifying which types of messages to send to that
1.14 millert 405: .Em facility .
1.2 dm 406: The local client (\fIrdist\fR) and the remote server (\fIrdistd\fR) each
1.14 millert 407: maintain their own copy of what types of messages to log to what facilities.
408: .Pp
1.8 aaron 409: The
1.14 millert 410: .Fl l
411: .Em logopts
1.2 dm 412: option to
1.14 millert 413: .Nm
1.2 dm 414: tells
1.14 millert 415: .Nm
1.2 dm 416: what logging options to use locally.
1.8 aaron 417: The
1.14 millert 418: .Fl L
419: .Em logopts
1.2 dm 420: option to
1.14 millert 421: .Nm
1.2 dm 422: tells
1.14 millert 423: .Nm
1.2 dm 424: what logging options to pass to the remote
1.14 millert 425: .Em rdistd
1.2 dm 426: server.
1.14 millert 427: .Pp
428: .Em logopts
429: should be of the form
430: .Bd -literal -offset indent
1.2 dm 431: \fIfacility\fB=\fItypes\fB:\fIfacility\fB=\fItypes...
1.14 millert 432: .Ed
433: .Pp
1.2 dm 434: The valid facility names are:
1.14 millert 435: .Bl -tag -width Ds
436: .It Sy stdout
1.2 dm 437: Messages to standard output.
1.14 millert 438: .It Sy file
439: Log to a file.
440: To specify the file name, use the format
441: .Dq \fBfile=\fIfilename\fB=\fItypes\fR .
1.12 aaron 442: e.g.,
1.14 millert 443: .Dq \fBfile=\fI/tmp/rdist.log\fB=\fIall,debug\fR .
444: .It Sy syslog
1.8 aaron 445: Use the
1.14 millert 446: .Xr syslogd 8
1.2 dm 447: facility.
1.14 millert 448: .It Sy notify
1.2 dm 449: Use the internal
1.14 millert 450: .Nm
451: .Sy notify
1.2 dm 452: facility.
453: This facility is used in conjunction with the
1.14 millert 454: .Sy notify
1.8 aaron 455: keyword in a
1.14 millert 456: .Pa distfile
1.2 dm 457: to specify what messages are mailed to the
1.14 millert 458: .Sy notify
1.2 dm 459: address.
1.14 millert 460: .El
461: .Pp
462: .Em types
463: should be a comma separated list of message types.
464: Each message type specified enables that message level.
465: This is unlike the
466: .Xr syslog 3
1.2 dm 467: system facility which uses an ascending order scheme.
1.14 millert 468: The following are the valid
469: .Em types:
470: .Bl -tag -width Ds
471: .It Sy change
1.2 dm 472: Things that change.
473: This includes files that are installed or updated in some way.
1.14 millert 474: .It Sy info
1.2 dm 475: General information.
1.14 millert 476: .It Sy notice
1.2 dm 477: General info about things that change.
478: This includes things like making directories which are needed in order
1.14 millert 479: to install a specific target, but which are not explicitly specified in the
480: .Pa distfile.
481: .It Sy nerror
1.2 dm 482: Normal errors that are not fatal.
1.14 millert 483: .It Sy ferror
1.2 dm 484: Fatal errors.
1.14 millert 485: .It Sy warning
1.2 dm 486: Warnings about errors which are not as serious as
1.14 millert 487: .Sy nerror
1.2 dm 488: type messages.
1.14 millert 489: .It Sy debug
1.2 dm 490: Debugging information.
1.14 millert 491: .It Sy all
1.2 dm 492: All but debug messages.
1.14 millert 493: .El
494: .Pp
1.2 dm 495: Here is a sample command line option:
1.14 millert 496: .Bd -literal -offset indent
497: -l stdout=all:syslog=change,notice:file=/tmp/rdist.log=all
498: .Ed
499: .Pp
1.2 dm 500: This entry will set local message logging to have all but debug
501: messages sent to standard output, change and notice messages will
1.8 aaron 502: be sent to
1.14 millert 503: .Xr syslog 3 ,
1.2 dm 504: and all messages will be written to the file
1.14 millert 505: .Pa /tmp/rdist.log .
506: .Sh DISTFILES
1.2 dm 507: The
1.14 millert 508: .Pa distfile
1.1 deraadt 509: contains a sequence of entries that specify the files
510: to be copied, the destination hosts, and what operations to perform
511: to do the updating. Each entry has one of the following formats.
1.14 millert 512: .Bd -literal -offset indent
1.1 deraadt 513: <variable name> `=' <name list>
1.2 dm 514: [ label: ] <source list> `\->' <destination list> <command list>
515: [ label: ] <source list> `::' <time_stamp file> <command list>
1.14 millert 516: .Ed
517: .Pp
1.1 deraadt 518: The first format is used for defining variables.
519: The second format is used for distributing files to other hosts.
520: The third format is used for making lists of files that have been changed
521: since some given date.
1.14 millert 522: The
523: .Em source list
524: specifies a list of files and/or directories on the local host which are to
525: be used as the master copy for distribution.
526: The
527: .Em destination list
528: is the list of hosts to which these files are to be copied.
529: Each file in the source list is added to a list of changes if the file
530: is out of date on the host which is being updated (second format) or
1.1 deraadt 531: the file is newer than the time stamp file (third format).
1.14 millert 532: .Pp
533: Labels are optional.
534: They are used to identify a command for partial updates.
535: .Pp
1.1 deraadt 536: Newlines, tabs, and blanks are only used as separators and are
1.14 millert 537: otherwise ignored.
538: Comments begin with
539: .Sq #
540: and end with a newline.
541: .Pp
542: Variables to be expanded begin with
543: .Sq $
544: followed by one character or a name enclosed in curly braces
545: (see the examples at the end).
546: .Pp
1.1 deraadt 547: The source and destination lists have the following format:
1.14 millert 548: .Bd -literal -offset indent
1.1 deraadt 549: <name>
1.14 millert 550: .Ed
1.1 deraadt 551: or
1.14 millert 552: .Bd -literal -compact -offset indent
1.10 aaron 553: `(' <zero or more names separated by whitespace> `)'
1.14 millert 554: .Ed
555: .Pp
1.2 dm 556: These simple lists can be modified by using one level of set addition,
557: subtraction, or intersection like this:
1.14 millert 558: .Bd -literal -offset indent
1.2 dm 559: list '-' list
1.14 millert 560: .Ed
1.2 dm 561: or
1.14 millert 562: .Bd -literal -compact -offset indent
1.2 dm 563: list '+' list
1.14 millert 564: .Ed
1.2 dm 565: or
1.14 millert 566: .Bd -literal -compact -offset indent
1.2 dm 567: list '&' list
1.14 millert 568: .Ed
569: .Pp
570: If additional modifications are needed (e.g.,
571: .Do
572: all servers and client machines except for the OSF/1 machines
573: .Dc )
574: then the list will have to be explicitly constructed in steps using
575: .Dq temporary
576: variables.
577: .Pp
1.1 deraadt 578: The shell meta-characters `[', `]', `{', `}', `*', and `?'
579: are recognized and expanded (on the local host only) in the same way as
1.14 millert 580: .Xr csh 1 .
1.1 deraadt 581: They can be escaped with a backslash.
582: The `~' character is also expanded in the same way as
1.14 millert 583: .Xr csh 1
1.1 deraadt 584: but is expanded separately on the local and destination hosts.
585: When the
1.14 millert 586: .Fl o Ns Ar whole
1.1 deraadt 587: option is used with a file name that begins with `~', everything except the
588: home directory is appended to the destination name.
589: File names which do not begin with `/' or `~' use the destination user's
590: home directory as the root directory for the rest of the file name.
1.14 millert 591: .Pp
1.1 deraadt 592: The command list consists of zero or more commands of the following
593: format.
1.14 millert 594: .Bl -column "except_pat" "<pattern list>" "opt_dest_name" ";" -offset indent
595: .It `install' Ta <options> Ta opt_dest_name Ta `;'
596: .It `notify' Ta <name list> Ta "" Ta `;'
597: .It `except' Ta <name list> Ta "" Ta `;'
598: .It `except_pat' Ta <pattern list> Ta "" Ta `;'
599: .It `special' Ta <name list> Ta string Ta `;'
600: .It `cmdspecial' Ta <name list> Ta string Ta `;'
601: .El
602: .Pp
1.1 deraadt 603: The
1.14 millert 604: .Em install
1.1 deraadt 605: command is used to copy out of date files and/or directories.
606: Each source file is copied to each host in the destination list.
607: Directories are recursively copied in the same way.
1.14 millert 608: .Em opt_dest_name
1.1 deraadt 609: is an optional parameter to rename files.
610: If no
1.14 millert 611: .Em install
612: command appears in the command list or the destination name is not specified,
1.1 deraadt 613: the source file name is used.
614: Directories in the path name will be created if they
615: do not exist on the remote host.
1.2 dm 616: The
1.14 millert 617: .Fl o Ns Ar distopts
618: option as specified above has the same semantics as
619: on the command line except
620: .Ar distopts
621: only apply to the files in the source list.
1.1 deraadt 622: The login name used on the destination host is the same as the local host
1.14 millert 623: unless the destination name is of the format
624: .Dq login@host .
625: .Pp
1.1 deraadt 626: The
1.14 millert 627: .Em notify
1.1 deraadt 628: command is used to mail the list of files updated (and any errors
629: that may have occurred) to the listed names.
630: If no `@' appears in the name, the destination host is appended to
631: the name
632: (e.g., name1@host, name2@host, ...).
1.14 millert 633: .Pp
1.1 deraadt 634: The
1.14 millert 635: .Em except
1.1 deraadt 636: command is used to update all of the files in the source list
1.14 millert 637: .Sy except
638: for the files listed in
639: .Em name list .
1.1 deraadt 640: This is usually used to copy everything in a directory except certain files.
1.14 millert 641: .Pp
1.1 deraadt 642: The
1.14 millert 643: .Em except_pat
1.1 deraadt 644: command is like the
1.14 millert 645: .Em except
646: command except that
647: .Em pattern list
648: is a list of regular expressions
1.1 deraadt 649: (see
1.14 millert 650: .Xr ed 1
1.1 deraadt 651: for details).
652: If one of the patterns matches some string within a file name, that file will
653: be ignored.
654: Note that since `\e' is a quote character, it must be doubled to become
1.14 millert 655: part of the regular expression.
656: Variables are expanded in
657: .Em pattern list
658: but not shell file pattern matching characters.
659: To include a `$', it must be escaped with `\e'.
660: .br
661: .Pp
1.1 deraadt 662: The
1.14 millert 663: .Em special
1.1 deraadt 664: command is used to specify
1.14 millert 665: .Xr sh 1
666: commands that are to be executed on the remote host after the file in
667: .Em name list
668: is updated or installed.
669: If the
670: .Em name list
671: is omitted then the shell commands will be executed for every file
672: updated or installed.
673: .Em string
1.1 deraadt 674: starts and ends with `"' and can cross multiple lines in
1.14 millert 675: .Pa distfile.
1.1 deraadt 676: Multiple commands to the shell should be separated by `;'.
677: Commands are executed in the user's home directory on the host
678: being updated.
679: The
1.14 millert 680: .Em special
1.1 deraadt 681: command can be used to rebuild private databases, etc.
682: after a program has been updated.
1.8 aaron 683: The following environment variables are set for each
1.14 millert 684: .Em special
1.2 dm 685: command:
1.14 millert 686: .Bl -tag -width "BASEFILE"
687: .It Ev FILE
1.2 dm 688: The full pathname of the local file that was just updated.
1.14 millert 689: .It Ev REMFILE
1.2 dm 690: The full pathname of the remote file that was just updated.
1.14 millert 691: .It BASEFILE
1.2 dm 692: The basename of the remote file that was just updated.
1.14 millert 693: .El
694: .Pp
1.2 dm 695: The
1.14 millert 696: .Em cmdspecial
1.2 dm 697: command is similar to the
1.14 millert 698: .Em special
1.2 dm 699: command, except it is executed only when the entire command is completed
700: instead of after each file is updated.
1.14 millert 701: The list of files is placed in the
702: .Ev FILES
703: environment variable.
1.2 dm 704: Each file name in
1.14 millert 705: .Ev FILES
1.2 dm 706: is separated by a `:' (colon).
1.14 millert 707: .Pp
708: If a hostname ends in a `+' (plus sign), then the plus
1.2 dm 709: is stripped off and NFS checks are disabled.
710: This is equivalent to disabling the
1.14 millert 711: .Fl o Ns Ar chknfs
1.2 dm 712: option just for this one host.
1.14 millert 713: .Pp
1.2 dm 714: The following is a small example.
1.14 millert 715: .Bd -literal -offset indent
1.2 dm 716: HOSTS = ( matisse root@arpa)
1.1 deraadt 717:
718: FILES = ( /bin /lib /usr/bin /usr/games
1.2 dm 719: /usr/include/{*.h,{stand,sys,vax*,pascal,machine}/*.h}
720: /usr/lib /usr/man/man? /usr/ucb /usr/local/rdist )
1.1 deraadt 721:
1.14 millert 722: EXLIB = ( Mail.rc aliases aliases.db crontab dshrc
723: sendmail.cf sendmail.hf sendmail.st uucp vfont )
1.1 deraadt 724:
725: ${FILES} -> ${HOSTS}
1.2 dm 726: install -oremove,chknfs ;
727: except /usr/lib/${EXLIB} ;
728: except /usr/games/lib ;
1.14 millert 729: special /usr/lib/sendmail "/usr/lib/sendmail -bi" ;
1.1 deraadt 730:
731: srcs:
732: /usr/src/bin -> arpa
1.2 dm 733: except_pat ( \e\e.o\e$ /SCCS\e$ ) ;
1.1 deraadt 734:
735: IMAGEN = (ips dviimp catdvi)
736:
737: imagen:
738: /usr/local/${IMAGEN} -> arpa
1.2 dm 739: install /usr/local/lib ;
740: notify ralph ;
1.1 deraadt 741:
742: ${FILES} :: stamp.cory
1.2 dm 743: notify root@cory ;
1.14 millert 744: .Ed
745: .Sh ENVIRONMENT
746: .Bl -tag -width "TMPDIR"
747: .It TMPDIR
748: Name of temporary directory to use.
749: Default is
750: .Pa /tmp.
751: .It RSH
752: Name of the default remote shell program to use.
753: Default is
754: .Pa ssh .
755: .El
756: .Sh FILES
757: .Bl -tag -width "$TMPDIR/rdist*" -compact
758: .It distfile
759: input command file
760: .It $TMPDIR/rdist*
761: temporary file for update lists
762: .El
763: .Sh SEE ALSO
764: .Xr sh 1 ,
765: .Xr csh 1 ,
766: .Xr rsh 1 ,
767: .Xr ssh 1 ,
768: .Xr stat 2 ,
769: .Xr rcmdsh 3
770: .Sh NOTES
771: If the basename of a file (the last component in the pathname) is ".", then
772: .Nm
1.2 dm 773: assumes the remote (destination) name is a directory.
1.11 aaron 774: i.e.,
1.14 millert 775: .Pa /tmp/ .
1.2 dm 776: means that
1.14 millert 777: .Pa /tmp
1.2 dm 778: should be a directory on the remote host.
1.14 millert 779: .Pp
1.2 dm 780: The following options are still recognized for backwards compatibility:
1.14 millert 781: .Pp
782: .Bd -filled -offset indent
783: .Fl v
784: .Fl N
785: .Fl O
786: .Fl q
787: .Fl b
788: .Fl r
789: .Fl R
790: .Fl s
791: .Fl w
792: .Fl y
793: .Fl h
794: .Fl i
795: .Fl x
796: .Ed
797: .Sh BUGS
1.2 dm 798: Source files must reside on the local host where rdist is executed.
1.14 millert 799: .Pp
1.1 deraadt 800: Variable expansion only works for name lists; there should be a general macro
801: facility.
1.14 millert 802: .Pp
803: .Nm
1.1 deraadt 804: aborts on files which have a negative mtime (before Jan 1, 1970).
1.14 millert 805: .Pp
1.2 dm 806: If a hardlinked file is listed more than once in the same target,
1.8 aaron 807: then
1.14 millert 808: .Nm
1.2 dm 809: will report missing links.
810: Only one instance of a link should be listed in each target.