Annotation of src/usr.bin/rdist/rdist.1, Revision 1.16
1.16 ! jmc 1: .\" $OpenBSD: rdist.1,v 1.15 2003/01/15 15:05:36 deraadt 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.16 ! jmc 398: .El
1.14 millert 399: .Sh MESSAGE LOGGING
400: .Nm
1.2 dm 401: uses a collection of predefined message
1.14 millert 402: .Em facilities
1.2 dm 403: that each contain a list of message
1.14 millert 404: .Sy types
1.8 aaron 405: specifying which types of messages to send to that
1.14 millert 406: .Em facility .
1.2 dm 407: The local client (\fIrdist\fR) and the remote server (\fIrdistd\fR) each
1.14 millert 408: maintain their own copy of what types of messages to log to what facilities.
409: .Pp
1.8 aaron 410: The
1.14 millert 411: .Fl l
412: .Em logopts
1.2 dm 413: option to
1.14 millert 414: .Nm
1.2 dm 415: tells
1.14 millert 416: .Nm
1.2 dm 417: what logging options to use locally.
1.8 aaron 418: The
1.14 millert 419: .Fl L
420: .Em logopts
1.2 dm 421: option to
1.14 millert 422: .Nm
1.2 dm 423: tells
1.14 millert 424: .Nm
1.2 dm 425: what logging options to pass to the remote
1.14 millert 426: .Em rdistd
1.2 dm 427: server.
1.14 millert 428: .Pp
429: .Em logopts
430: should be of the form
431: .Bd -literal -offset indent
1.2 dm 432: \fIfacility\fB=\fItypes\fB:\fIfacility\fB=\fItypes...
1.14 millert 433: .Ed
434: .Pp
1.2 dm 435: The valid facility names are:
1.14 millert 436: .Bl -tag -width Ds
437: .It Sy stdout
1.2 dm 438: Messages to standard output.
1.14 millert 439: .It Sy file
440: Log to a file.
441: To specify the file name, use the format
442: .Dq \fBfile=\fIfilename\fB=\fItypes\fR .
1.12 aaron 443: e.g.,
1.14 millert 444: .Dq \fBfile=\fI/tmp/rdist.log\fB=\fIall,debug\fR .
445: .It Sy syslog
1.8 aaron 446: Use the
1.14 millert 447: .Xr syslogd 8
1.2 dm 448: facility.
1.14 millert 449: .It Sy notify
1.2 dm 450: Use the internal
1.14 millert 451: .Nm
452: .Sy notify
1.2 dm 453: facility.
454: This facility is used in conjunction with the
1.14 millert 455: .Sy notify
1.8 aaron 456: keyword in a
1.14 millert 457: .Pa distfile
1.2 dm 458: to specify what messages are mailed to the
1.14 millert 459: .Sy notify
1.2 dm 460: address.
1.14 millert 461: .El
462: .Pp
463: .Em types
464: should be a comma separated list of message types.
465: Each message type specified enables that message level.
466: This is unlike the
467: .Xr syslog 3
1.2 dm 468: system facility which uses an ascending order scheme.
1.14 millert 469: The following are the valid
470: .Em types:
471: .Bl -tag -width Ds
472: .It Sy change
1.2 dm 473: Things that change.
474: This includes files that are installed or updated in some way.
1.14 millert 475: .It Sy info
1.2 dm 476: General information.
1.14 millert 477: .It Sy notice
1.2 dm 478: General info about things that change.
479: This includes things like making directories which are needed in order
1.14 millert 480: to install a specific target, but which are not explicitly specified in the
481: .Pa distfile.
482: .It Sy nerror
1.2 dm 483: Normal errors that are not fatal.
1.14 millert 484: .It Sy ferror
1.2 dm 485: Fatal errors.
1.14 millert 486: .It Sy warning
1.2 dm 487: Warnings about errors which are not as serious as
1.14 millert 488: .Sy nerror
1.2 dm 489: type messages.
1.14 millert 490: .It Sy debug
1.2 dm 491: Debugging information.
1.14 millert 492: .It Sy all
1.2 dm 493: All but debug messages.
1.14 millert 494: .El
495: .Pp
1.2 dm 496: Here is a sample command line option:
1.14 millert 497: .Bd -literal -offset indent
498: -l stdout=all:syslog=change,notice:file=/tmp/rdist.log=all
499: .Ed
500: .Pp
1.2 dm 501: This entry will set local message logging to have all but debug
502: messages sent to standard output, change and notice messages will
1.8 aaron 503: be sent to
1.14 millert 504: .Xr syslog 3 ,
1.2 dm 505: and all messages will be written to the file
1.14 millert 506: .Pa /tmp/rdist.log .
507: .Sh DISTFILES
1.2 dm 508: The
1.14 millert 509: .Pa distfile
1.1 deraadt 510: contains a sequence of entries that specify the files
511: to be copied, the destination hosts, and what operations to perform
512: to do the updating. Each entry has one of the following formats.
1.14 millert 513: .Bd -literal -offset indent
1.1 deraadt 514: <variable name> `=' <name list>
1.2 dm 515: [ label: ] <source list> `\->' <destination list> <command list>
516: [ label: ] <source list> `::' <time_stamp file> <command list>
1.14 millert 517: .Ed
518: .Pp
1.1 deraadt 519: The first format is used for defining variables.
520: The second format is used for distributing files to other hosts.
521: The third format is used for making lists of files that have been changed
522: since some given date.
1.14 millert 523: The
524: .Em source list
525: specifies a list of files and/or directories on the local host which are to
526: be used as the master copy for distribution.
527: The
528: .Em destination list
529: is the list of hosts to which these files are to be copied.
530: Each file in the source list is added to a list of changes if the file
531: is out of date on the host which is being updated (second format) or
1.1 deraadt 532: the file is newer than the time stamp file (third format).
1.14 millert 533: .Pp
534: Labels are optional.
535: They are used to identify a command for partial updates.
536: .Pp
1.1 deraadt 537: Newlines, tabs, and blanks are only used as separators and are
1.14 millert 538: otherwise ignored.
539: Comments begin with
540: .Sq #
541: and end with a newline.
542: .Pp
543: Variables to be expanded begin with
544: .Sq $
545: followed by one character or a name enclosed in curly braces
546: (see the examples at the end).
547: .Pp
1.1 deraadt 548: The source and destination lists have the following format:
1.14 millert 549: .Bd -literal -offset indent
1.1 deraadt 550: <name>
1.14 millert 551: .Ed
1.1 deraadt 552: or
1.14 millert 553: .Bd -literal -compact -offset indent
1.10 aaron 554: `(' <zero or more names separated by whitespace> `)'
1.14 millert 555: .Ed
556: .Pp
1.2 dm 557: These simple lists can be modified by using one level of set addition,
558: subtraction, or intersection like this:
1.14 millert 559: .Bd -literal -offset indent
1.2 dm 560: list '-' list
1.14 millert 561: .Ed
1.2 dm 562: or
1.14 millert 563: .Bd -literal -compact -offset indent
1.2 dm 564: list '+' list
1.14 millert 565: .Ed
1.2 dm 566: or
1.14 millert 567: .Bd -literal -compact -offset indent
1.2 dm 568: list '&' list
1.14 millert 569: .Ed
570: .Pp
571: If additional modifications are needed (e.g.,
572: .Do
573: all servers and client machines except for the OSF/1 machines
574: .Dc )
575: then the list will have to be explicitly constructed in steps using
576: .Dq temporary
577: variables.
578: .Pp
1.1 deraadt 579: The shell meta-characters `[', `]', `{', `}', `*', and `?'
580: are recognized and expanded (on the local host only) in the same way as
1.14 millert 581: .Xr csh 1 .
1.1 deraadt 582: They can be escaped with a backslash.
583: The `~' character is also expanded in the same way as
1.14 millert 584: .Xr csh 1
1.1 deraadt 585: but is expanded separately on the local and destination hosts.
586: When the
1.14 millert 587: .Fl o Ns Ar whole
1.1 deraadt 588: option is used with a file name that begins with `~', everything except the
589: home directory is appended to the destination name.
590: File names which do not begin with `/' or `~' use the destination user's
591: home directory as the root directory for the rest of the file name.
1.14 millert 592: .Pp
1.1 deraadt 593: The command list consists of zero or more commands of the following
594: format.
1.14 millert 595: .Bl -column "except_pat" "<pattern list>" "opt_dest_name" ";" -offset indent
596: .It `install' Ta <options> Ta opt_dest_name Ta `;'
597: .It `notify' Ta <name list> Ta "" Ta `;'
598: .It `except' Ta <name list> Ta "" Ta `;'
599: .It `except_pat' Ta <pattern list> Ta "" Ta `;'
600: .It `special' Ta <name list> Ta string Ta `;'
601: .It `cmdspecial' Ta <name list> Ta string Ta `;'
602: .El
603: .Pp
1.1 deraadt 604: The
1.14 millert 605: .Em install
1.1 deraadt 606: command is used to copy out of date files and/or directories.
607: Each source file is copied to each host in the destination list.
608: Directories are recursively copied in the same way.
1.14 millert 609: .Em opt_dest_name
1.1 deraadt 610: is an optional parameter to rename files.
611: If no
1.14 millert 612: .Em install
613: command appears in the command list or the destination name is not specified,
1.1 deraadt 614: the source file name is used.
615: Directories in the path name will be created if they
616: do not exist on the remote host.
1.2 dm 617: The
1.14 millert 618: .Fl o Ns Ar distopts
619: option as specified above has the same semantics as
620: on the command line except
621: .Ar distopts
622: only apply to the files in the source list.
1.1 deraadt 623: The login name used on the destination host is the same as the local host
1.14 millert 624: unless the destination name is of the format
625: .Dq login@host .
626: .Pp
1.1 deraadt 627: The
1.14 millert 628: .Em notify
1.1 deraadt 629: command is used to mail the list of files updated (and any errors
630: that may have occurred) to the listed names.
631: If no `@' appears in the name, the destination host is appended to
632: the name
633: (e.g., name1@host, name2@host, ...).
1.14 millert 634: .Pp
1.1 deraadt 635: The
1.14 millert 636: .Em except
1.1 deraadt 637: command is used to update all of the files in the source list
1.14 millert 638: .Sy except
639: for the files listed in
640: .Em name list .
1.1 deraadt 641: This is usually used to copy everything in a directory except certain files.
1.14 millert 642: .Pp
1.1 deraadt 643: The
1.14 millert 644: .Em except_pat
1.1 deraadt 645: command is like the
1.14 millert 646: .Em except
647: command except that
648: .Em pattern list
649: is a list of regular expressions
1.1 deraadt 650: (see
1.14 millert 651: .Xr ed 1
1.1 deraadt 652: for details).
653: If one of the patterns matches some string within a file name, that file will
654: be ignored.
655: Note that since `\e' is a quote character, it must be doubled to become
1.14 millert 656: part of the regular expression.
657: Variables are expanded in
658: .Em pattern list
659: but not shell file pattern matching characters.
660: To include a `$', it must be escaped with `\e'.
661: .br
662: .Pp
1.1 deraadt 663: The
1.14 millert 664: .Em special
1.1 deraadt 665: command is used to specify
1.14 millert 666: .Xr sh 1
667: commands that are to be executed on the remote host after the file in
668: .Em name list
669: is updated or installed.
670: If the
671: .Em name list
672: is omitted then the shell commands will be executed for every file
673: updated or installed.
674: .Em string
1.1 deraadt 675: starts and ends with `"' and can cross multiple lines in
1.14 millert 676: .Pa distfile.
1.1 deraadt 677: Multiple commands to the shell should be separated by `;'.
678: Commands are executed in the user's home directory on the host
679: being updated.
680: The
1.14 millert 681: .Em special
1.1 deraadt 682: command can be used to rebuild private databases, etc.
683: after a program has been updated.
1.8 aaron 684: The following environment variables are set for each
1.14 millert 685: .Em special
1.2 dm 686: command:
1.14 millert 687: .Bl -tag -width "BASEFILE"
688: .It Ev FILE
1.2 dm 689: The full pathname of the local file that was just updated.
1.14 millert 690: .It Ev REMFILE
1.2 dm 691: The full pathname of the remote file that was just updated.
1.14 millert 692: .It BASEFILE
1.2 dm 693: The basename of the remote file that was just updated.
1.14 millert 694: .El
695: .Pp
1.2 dm 696: The
1.14 millert 697: .Em cmdspecial
1.2 dm 698: command is similar to the
1.14 millert 699: .Em special
1.2 dm 700: command, except it is executed only when the entire command is completed
701: instead of after each file is updated.
1.14 millert 702: The list of files is placed in the
703: .Ev FILES
704: environment variable.
1.2 dm 705: Each file name in
1.14 millert 706: .Ev FILES
1.2 dm 707: is separated by a `:' (colon).
1.14 millert 708: .Pp
709: If a hostname ends in a `+' (plus sign), then the plus
1.2 dm 710: is stripped off and NFS checks are disabled.
711: This is equivalent to disabling the
1.14 millert 712: .Fl o Ns Ar chknfs
1.2 dm 713: option just for this one host.
1.14 millert 714: .Pp
1.2 dm 715: The following is a small example.
1.14 millert 716: .Bd -literal -offset indent
1.2 dm 717: HOSTS = ( matisse root@arpa)
1.1 deraadt 718:
719: FILES = ( /bin /lib /usr/bin /usr/games
1.2 dm 720: /usr/include/{*.h,{stand,sys,vax*,pascal,machine}/*.h}
721: /usr/lib /usr/man/man? /usr/ucb /usr/local/rdist )
1.1 deraadt 722:
1.14 millert 723: EXLIB = ( Mail.rc aliases aliases.db crontab dshrc
724: sendmail.cf sendmail.hf sendmail.st uucp vfont )
1.1 deraadt 725:
726: ${FILES} -> ${HOSTS}
1.2 dm 727: install -oremove,chknfs ;
728: except /usr/lib/${EXLIB} ;
729: except /usr/games/lib ;
1.14 millert 730: special /usr/lib/sendmail "/usr/lib/sendmail -bi" ;
1.1 deraadt 731:
732: srcs:
733: /usr/src/bin -> arpa
1.2 dm 734: except_pat ( \e\e.o\e$ /SCCS\e$ ) ;
1.1 deraadt 735:
736: IMAGEN = (ips dviimp catdvi)
737:
738: imagen:
739: /usr/local/${IMAGEN} -> arpa
1.2 dm 740: install /usr/local/lib ;
741: notify ralph ;
1.1 deraadt 742:
743: ${FILES} :: stamp.cory
1.2 dm 744: notify root@cory ;
1.14 millert 745: .Ed
746: .Sh ENVIRONMENT
747: .Bl -tag -width "TMPDIR"
748: .It TMPDIR
749: Name of temporary directory to use.
750: Default is
751: .Pa /tmp.
752: .It RSH
753: Name of the default remote shell program to use.
754: Default is
755: .Pa ssh .
756: .El
757: .Sh FILES
758: .Bl -tag -width "$TMPDIR/rdist*" -compact
759: .It distfile
760: input command file
761: .It $TMPDIR/rdist*
762: temporary file for update lists
763: .El
764: .Sh SEE ALSO
765: .Xr sh 1 ,
766: .Xr csh 1 ,
767: .Xr rsh 1 ,
768: .Xr ssh 1 ,
769: .Xr stat 2 ,
770: .Xr rcmdsh 3
771: .Sh NOTES
772: If the basename of a file (the last component in the pathname) is ".", then
773: .Nm
1.2 dm 774: assumes the remote (destination) name is a directory.
1.11 aaron 775: i.e.,
1.14 millert 776: .Pa /tmp/ .
1.2 dm 777: means that
1.14 millert 778: .Pa /tmp
1.2 dm 779: should be a directory on the remote host.
1.14 millert 780: .Pp
1.2 dm 781: The following options are still recognized for backwards compatibility:
1.14 millert 782: .Pp
783: .Bd -filled -offset indent
784: .Fl v
785: .Fl N
786: .Fl O
787: .Fl q
788: .Fl b
789: .Fl r
790: .Fl R
791: .Fl s
792: .Fl w
793: .Fl y
794: .Fl h
795: .Fl i
796: .Fl x
797: .Ed
798: .Sh BUGS
1.2 dm 799: Source files must reside on the local host where rdist is executed.
1.14 millert 800: .Pp
1.1 deraadt 801: Variable expansion only works for name lists; there should be a general macro
802: facility.
1.14 millert 803: .Pp
804: .Nm
1.1 deraadt 805: aborts on files which have a negative mtime (before Jan 1, 1970).
1.14 millert 806: .Pp
1.2 dm 807: If a hardlinked file is listed more than once in the same target,
1.8 aaron 808: then
1.14 millert 809: .Nm
1.2 dm 810: will report missing links.
811: Only one instance of a link should be listed in each target.