forgot to document the -d flag (it's what -I used to be)
[unix-history] / usr / src / usr.bin / rdist / rdist.1
CommitLineData
b5dc1377 1.\" Copyright (c) 1985, 1990 The Regents of the University of California.
1c4ad2f3 2.\" All rights reserved.
6be9699a 3.\"
b5dc1377 4.\" %sccs.include.redist.man%
1c4ad2f3 5.\"
5325ced3 6.\" @(#)rdist.1 6.9 (Berkeley) %G%
6be9699a 7.\"
b5dc1377
CL
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.
6be9699a
KM
33It preserves the owner, group, mode, and mtime of files if possible and
34can update programs that are executing.
b5dc1377 35.Nm Rdist
6be9699a 36reads commands from
b5dc1377 37.Ar distfile
6be9699a 38to direct the updating of files and/or directories.
b5dc1377
CL
39.Pp
40Options specific to the first SYNOPSIS form:
41.Pp
5325ced3 42.Tw Fl
b5dc1377 43.Tp Fl
6be9699a 44If
b5dc1377
CL
45.Ar distfile
46is
5325ced3 47.Sq Fl ,
b5dc1377
CL
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
5325ced3 60.Sq Fl
b5dc1377
CL
61option is not specified, the program looks first for
62.Dq Pa distfile ,
63then
64.Dq Pa Distfile
65to use as the input.
6be9699a 66If no names are specified on the command line,
b5dc1377 67.Nm rdist
6be9699a 68will update all of the files and directories listed in
b5dc1377 69.Ar distfile .
6be9699a
KM
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.
b5dc1377
CL
75.Pp
76Options specific to the second SYNOPSIS form:
77.Pp
78.Tp Fl c
79Forces
80.Nm rdist
6be9699a 81to interpret the remaining arguments as a small
b5dc1377
CL
82.Ar distfile .
83.Pp
6be9699a 84The equivalent distfile is as follows.
b5dc1377
CL
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
6be9699a 105Define
b5dc1377 106.Ar var
6be9699a 107to have
b5dc1377 108.Ar value .
6be9699a 109The
b5dc1377 110.Fl d
6be9699a 111option is used to define or override variable definitions in the
b5dc1377
CL
112.Ar distfile .
113.Ar Value
6be9699a
KM
114can be the empty string, one name, or a list of names surrounded by
115parentheses and separated by tabs and/or spaces.
b5dc1377
CL
116.Tp Cx Fl m
117.Cx \&\ \&
118.Ar host
119.Cx
6be9699a 120Limit which machines are to be updated. Multiple
b5dc1377 121.Fl m
6be9699a 122arguments can be given to limit updates to a subset of the hosts listed the
b5dc1377
CL
123.Ar distfile .
124.Tp Fl n
6be9699a
KM
125Print the commands without executing them. This option is
126useful for debugging
b5dc1377
CL
127.Ar distfile .
128.Tp Fl q
6be9699a
KM
129Quiet mode. Files that are being modified are normally
130printed on standard output. The
b5dc1377 131.Fl q
6be9699a 132option suppresses this.
b5dc1377 133.Tp Fl R
6be9699a
KM
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.
b5dc1377 137.Tp Fl h
6be9699a
KM
138Follow symbolic links. Copy the file that the link points to rather than the
139link itself.
b5dc1377 140.Tp Fl i
6be9699a 141Ignore unresolved links.
b5dc1377 142.Nm Rdist
6be9699a
KM
143will normally try to maintain the link structure of files being transfered
144and warn the user if all the links cannot be found.
b5dc1377 145.Tp Fl v
6be9699a
KM
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.
b5dc1377 149.Tp Fl w
6be9699a
KM
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.
b5dc1377 156.Tp Fl y
6be9699a 157Younger mode. Files are normally updated if their
b5dc1377 158.Ar mtime
6be9699a 159and
b5dc1377 160.Ar size
6be9699a 161(see
b5dc1377 162.Xr stat 2 )
6be9699a 163disagree. The
b5dc1377 164.Fl y
6be9699a 165option causes
b5dc1377 166.Nm rdist
6be9699a
KM
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.
b5dc1377 171.Tp Fl b
6be9699a
KM
172Binary comparison. Perform a binary comparison and update files if they differ
173rather than comparing dates and sizes.
b5dc1377
CL
174.Tp
175.Pp
176.Ar Distfile
6be9699a
KM
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.
b5dc1377
CL
180.Pp
181.Ds I
6be9699a 182<variable name> `=' <name list>
b5dc1377
CL
183[label:]<source list> `\->' <destination list> <command list>
184[label:]<source list> `::' <time_stamp file> <command list>
185.De
186.Pp
6be9699a
KM
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.
b5dc1377
CL
191The
192.Ar source list
193specifies a
6be9699a
KM
194list of files and/or directories on the local host which are to be used
195as the master copy for distribution.
b5dc1377
CL
196The
197.Ar destination list
198is the list of hosts to which these files are to be
78261a91 199copied. Each file in the source list is added to a list of changes
c33a908d 200if the file is out of date on the host which is being updated (second format) or
6be9699a 201the file is newer than the time stamp file (third format).
b5dc1377 202.Pp
6be9699a 203Labels are optional. They are used to identify a command for partial updates.
b5dc1377 204.Pp
6be9699a
KM
205Newlines, tabs, and blanks are only used as separators and are
206otherwise ignored. Comments begin with `#' and end with a newline.
b5dc1377 207.Pp
6be9699a
KM
208Variables to be expanded begin with `$' followed by one character or
209a name enclosed in curly braces (see the examples at the end).
b5dc1377 210.Pp
6be9699a 211The source and destination lists have the following format:
b5dc1377
CL
212.Pp
213.Ds I
6be9699a 214<name>
b5dc1377 215.De
6be9699a 216or
b5dc1377 217.Ds I
6be9699a 218`(' <zero or more names separated by white-space> `)'
b5dc1377
CL
219.De
220.Pp
6be9699a
KM
221The shell meta-characters `[', `]', `{', `}', `*', and `?'
222are recognized and expanded (on the local host only) in the same way as
b5dc1377 223.Xr csh 1 .
6be9699a
KM
224They can be escaped with a backslash.
225The `~' character is also expanded in the same way as
b5dc1377 226.Xr csh 1
6be9699a
KM
227but is expanded separately on the local and destination hosts.
228When the
b5dc1377 229.Fl w
6be9699a
KM
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.
b5dc1377 234.Pp
6be9699a
KM
235The command list consists of zero or more commands of the following
236format.
b5dc1377
CL
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
6be9699a 247The
b5dc1377 248.Ic install
6be9699a
KM
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.
b5dc1377 252.Ar Opt_dest_name
6be9699a
KM
253is an optional parameter to rename files.
254If no
b5dc1377 255.Ic install
6be9699a
KM
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.
a026e4fc
JL
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.
6be9699a 265The
b5dc1377 266.Ar options
6be9699a
KM
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".
b5dc1377 273.Pp
6be9699a 274The
b5dc1377 275.Ic notify
6be9699a
KM
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, ...).
b5dc1377 281.Pp
6be9699a 282The
b5dc1377 283.Ic except
6be9699a 284command is used to update all of the files in the source list
b5dc1377
CL
285.Ic except
286for the files listed in
287.Ar name list .
a026e4fc 288This is usually used to copy everything in a directory except certain files.
b5dc1377 289.Pp
6be9699a 290The
b5dc1377 291.Ic except_pat
6be9699a 292command is like the
b5dc1377
CL
293.Ic except
294command except that
295.Ar pattern list
296is a list of regular expressions
6be9699a 297(see
b5dc1377 298.Xr ed 1
6be9699a
KM
299for details).
300If one of the patterns matches some string within a file name, that file will
301be ignored.
a026e4fc 302Note that since `\e' is a quote character, it must be doubled to become
b5dc1377
CL
303part of the regular expression. Variables are expanded in
304.Ar pattern list
a026e4fc
JL
305but not shell file pattern matching characters. To include a `$', it
306must be escaped with `\e'.
b5dc1377 307.Pp
6be9699a 308The
b5dc1377 309.Ic special
6be9699a 310command is used to specify
b5dc1377 311.Xr sh 1
6be9699a 312commands that are to be executed on the
b5dc1377
CL
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
6be9699a
KM
319for every file updated or installed. The shell variable `FILE' is set
320to the current filename before executing the commands in
b5dc1377
CL
321.Ar string .
322.Ar String
6be9699a 323starts and ends with `"' and can cross multiple lines in
b5dc1377 324.Ar distfile .
6be9699a
KM
325Multiple commands to the shell should be separated by `;'.
326Commands are executed in the user's home directory on the host
327being updated.
328The
b5dc1377 329.Ar special
6be9699a
KM
330command can be used to rebuild private databases, etc.
331after a program has been updated.
b5dc1377
CL
332.Pp
333The following is a small example:
334.Pp
335.Ds I
5325ced3 336HOSTS = ( matisse root@arpa )
b5dc1377 337.sp
6be9699a 338FILES = ( /bin /lib /usr/bin /usr/games
b5dc1377
CL
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
6be9699a 342EXLIB = ( Mail.rc aliases aliases.dir aliases.pag crontab dshrc
b5dc1377
CL
343\tsendmail.cf sendmail.fc sendmail.hf sendmail.st uucp vfont )
344.sp
6be9699a 345${FILES} -> ${HOSTS}
b5dc1377
CL
346\tinstall -R ;
347\texcept /usr/lib/${EXLIB} ;
348\texcept /usr/games/lib ;
349\tspecial /usr/lib/sendmail "/usr/lib/sendmail -bz" ;
350.sp
6be9699a
KM
351srcs:
352/usr/src/bin -> arpa
b5dc1377
CL
353\texcept_pat ( \e\e.o\e$ /SCCS\e$ ) ;
354.sp
6be9699a 355IMAGEN = (ips dviimp catdvi)
b5dc1377 356.sp
6be9699a
KM
357imagen:
358/usr/local/${IMAGEN} -> arpa
b5dc1377
CL
359\tinstall /usr/local/lib ;
360\tnotify ralph ;
361.sp
6be9699a 362${FILES} :: stamp.cory
b5dc1377
CL
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
a026e4fc
JL
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.
b5dc1377
CL
384.Sh BUGS
385Source files must reside on the local host where
386.Nm rdist
387is executed.
388.Pp
6be9699a
KM
389There is no easy way to have a special command executed after all files
390in a directory have been updated.
b5dc1377 391.Pp
a026e4fc 392Variable expansion only works for name lists; there should be a general macro
6be9699a 393facility.
b5dc1377
CL
394.Pp
395.Nm Rdist
a026e4fc 396aborts on files which have a negative mtime (before Jan 1, 1970).
b5dc1377 397.Pp
a026e4fc
JL
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.