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