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