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