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