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