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