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