xref: /netbsd-src/usr.bin/rdist/rdist.1 (revision 01869ca4d24a86379a68731bf9706a9f0820fe4e)
1*01869ca4Swiz.\"	$NetBSD: rdist.1,v 1.21 2017/07/03 21:34:21 wiz Exp $
23aab4f7dSthorpej.\"
3a5bfdf78Scgd.\" Copyright (c) 1985, 1990, 1993
4a5bfdf78Scgd.\"	The Regents of the University of California.  All rights reserved.
561f28255Scgd.\"
661f28255Scgd.\" Redistribution and use in source and binary forms, with or without
761f28255Scgd.\" modification, are permitted provided that the following conditions
861f28255Scgd.\" are met:
961f28255Scgd.\" 1. Redistributions of source code must retain the above copyright
1061f28255Scgd.\"    notice, this list of conditions and the following disclaimer.
1161f28255Scgd.\" 2. Redistributions in binary form must reproduce the above copyright
1261f28255Scgd.\"    notice, this list of conditions and the following disclaimer in the
1361f28255Scgd.\"    documentation and/or other materials provided with the distribution.
1489aaa1bbSagc.\" 3. Neither the name of the University nor the names of its contributors
1561f28255Scgd.\"    may be used to endorse or promote products derived from this software
1661f28255Scgd.\"    without specific prior written permission.
1761f28255Scgd.\"
1861f28255Scgd.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1961f28255Scgd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2061f28255Scgd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2161f28255Scgd.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2261f28255Scgd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2361f28255Scgd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2461f28255Scgd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2561f28255Scgd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2661f28255Scgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2761f28255Scgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2861f28255Scgd.\" SUCH DAMAGE.
2961f28255Scgd.\"
300026c9e9Smrg.\"	from: @(#)rdist.1	8.3 (Berkeley) 3/17/94
3161f28255Scgd.\"
320026c9e9Smrg.Dd March 17, 1994
3361f28255Scgd.Dt RDIST 1
349e44e9b5Sgarbled.Os
3561f28255Scgd.Sh NAME
3661f28255Scgd.Nm rdist
3761f28255Scgd.Nd remote file distribution program
3861f28255Scgd.Sh SYNOPSIS
393b3cf635Slukem.Nm
406b6cae1aSwiz.Op Fl bDhinqRvwy
4161f28255Scgd.Op Fl d Ar var=value
426b6cae1aSwiz.Op Fl f Ar distfile
43a5bfdf78Scgd.Op Fl m Ar host
4461f28255Scgd.Op Ar name ...
45990562bfSwiz.Nm
466b6cae1aSwiz.Op Fl bDhinqRvwy
4761f28255Scgd.Fl c
4861f28255Scgd.Ar name ...
4961f28255Scgd.Oo login@ Oc Ns Ar host Ns Op :dest
5061f28255Scgd.Sh DESCRIPTION
513b3cf635Slukem.Nm
5261f28255Scgdis a program to maintain identical copies of files over multiple hosts.
5361f28255ScgdIt preserves the owner, group, mode, and mtime of files if possible and
5461f28255Scgdcan update programs that are executing.
553b3cf635Slukem.Nm
5661f28255Scgdreads commands from
5761f28255Scgd.Ar distfile
5861f28255Scgdto direct the updating of files and/or directories.
5961f28255Scgd.Pp
6061f28255ScgdOptions specific to the first SYNOPSIS form:
6161f28255Scgd.Pp
6261f28255Scgd.Bl -tag -width indent
6361f28255Scgd.It Fl
6461f28255ScgdIf
6561f28255Scgd.Ar distfile
6661f28255Scgdis
6761f28255Scgd.Sq Fl ,
6861f28255Scgdthe standard input is used.
6961f28255Scgd.It Fl f Ar distfile
7061f28255ScgdUse the specified
7161f28255Scgd.Ar distfile .
7261f28255Scgd.El
7361f28255Scgd.Pp
7461f28255ScgdIf either the
7561f28255Scgd.Fl f
7661f28255Scgdor
7761f28255Scgd.Sq Fl
7861f28255Scgdoption is not specified, the program looks first for
7961f28255Scgd.Dq Pa distfile ,
8061f28255Scgdthen
8161f28255Scgd.Dq Pa Distfile
8261f28255Scgdto use as the input.
8361f28255ScgdIf no names are specified on the command line,
843b3cf635Slukem.Nm
8561f28255Scgdwill update all of the files and directories listed in
8661f28255Scgd.Ar distfile  .
8761f28255ScgdOtherwise, the argument is taken to be the name of a file to be updated
88be8ae688Sgrantor the label of a command to execute.
89be8ae688SgrantIf label and file names conflict, it is assumed to be a label.
9061f28255ScgdThese may be used together to update specific files
9161f28255Scgdusing specific commands.
9261f28255Scgd.Pp
9361f28255ScgdOptions specific to the second SYNOPSIS form:
9461f28255Scgd.Pp
958bd7cb6aSross.Bl -tag -width Fl
9661f28255Scgd.It Fl c
9761f28255ScgdForces
983b3cf635Slukem.Nm
9961f28255Scgdto interpret the remaining arguments as a small
10061f28255Scgd.Ar distfile  .
10161f28255Scgd.Pp
10261f28255ScgdThe equivalent distfile is as follows.
10361f28255Scgd.Pp
10461f28255Scgd.Bd -filled -offset indent -compact
10561f28255Scgd.Pq Ar name ...
106*01869ca4Swiz.Li ->
10761f28255Scgd.Op Ar login@
10861f28255Scgd.Ar host
109d965d852Sjoerg.Ed
110d965d852Sjoerg.Bd -filled -offset indentindent -compact
11161f28255Scgd.Li install
11261f28255Scgd.Op Ar dest ;
11361f28255Scgd.Ed
11461f28255Scgd.El
11561f28255Scgd.Pp
11661f28255ScgdOptions common to both forms:
11761f28255Scgd.Pp
11861f28255Scgd.Bl -tag -width Ic
11961f28255Scgd.It Fl b
120be8ae688SgrantBinary comparison.
121be8ae688SgrantPerform a binary comparison and update files if they differ
12261f28255Scgdrather than comparing dates and sizes.
12361f28255Scgd.It Fl d Ar var=value
12461f28255ScgdDefine
12561f28255Scgd.Ar var
12661f28255Scgdto have
12761f28255Scgd.Ar value  .
12861f28255ScgdThe
12961f28255Scgd.Fl d
13061f28255Scgdoption is used to define or override variable definitions in the
13161f28255Scgd.Ar distfile  .
13261f28255Scgd.Ar Value
13361f28255Scgdcan be the empty string, one name, or a list of names surrounded by
13461f28255Scgdparentheses and separated by tabs and/or spaces.
1358370dbf8Stron.It Fl D
1368370dbf8StronTurn on debugging.
13761f28255Scgd.It Fl h
138be8ae688SgrantFollow symbolic links.
139be8ae688SgrantCopy the file that the link points to rather than the
14061f28255Scgdlink itself.
14161f28255Scgd.It Fl i
14261f28255ScgdIgnore unresolved links.
1433b3cf635Slukem.Nm
144035fd397Scgdwill normally try to maintain the link structure of files being transferred
14561f28255Scgdand warn the user if all the links cannot be found.
14661f28255Scgd.It Fl m Ar host
147be8ae688SgrantLimit which machines are to be updated.
148be8ae688SgrantMultiple
14961f28255Scgd.Fl m
150a5bfdf78Scgdarguments can be given to limit updates to a subset of the hosts listed in the
15161f28255Scgd.Ar distfile  .
15261f28255Scgd.It Fl n
153be8ae688SgrantPrint the commands without executing them.
154be8ae688SgrantThis option is
15561f28255Scgduseful for debugging
15661f28255Scgd.Ar distfile  .
15761f28255Scgd.It Fl q
158be8ae688SgrantQuiet mode.
159be8ae688SgrantFiles that are being modified are normally
160be8ae688Sgrantprinted on standard output.
161be8ae688SgrantThe
16261f28255Scgd.Fl q
16361f28255Scgdoption suppresses this.
16461f28255Scgd.It Fl R
165be8ae688SgrantRemove extraneous files.
166be8ae688SgrantIf a directory is being updated, any files that exist
16761f28255Scgdon the remote host that do not exist in the master directory are removed.
1682c7d5d92SjtcThis is useful for maintaining truly identical copies of directories.
16961f28255Scgd.It Fl v
170be8ae688SgrantVerify that the files are up to date on all the hosts.
171be8ae688SgrantAny files
17261f28255Scgdthat are out of date will be displayed but no files will be changed
17361f28255Scgdnor any mail sent.
17461f28255Scgd.It Fl w
175be8ae688SgrantWhole mode.
176be8ae688SgrantThe whole file name is appended to the destination directory
177be8ae688Sgrantname.
178be8ae688SgrantNormally, only the last component of a name is used when renaming files.
17961f28255ScgdThis will preserve the directory structure of the files being
180be8ae688Sgrantcopied instead of flattening the directory structure.
181be8ae688SgrantFor example,
18261f28255Scgdrenaming a list of files such as ( dir1/f1 dir2/f2 ) to dir3 would create
18361f28255Scgdfiles dir3/dir1/f1 and dir3/dir2/f2 instead of dir3/f1 and dir3/f2.
18461f28255Scgd.It Fl y
185be8ae688SgrantYounger mode.
186be8ae688SgrantFiles are normally updated if their
18761f28255Scgd.Ar mtime
18861f28255Scgdand
18961f28255Scgd.Ar size
19061f28255Scgd(see
19161f28255Scgd.Xr stat 2 )
192be8ae688Sgrantdisagree.
193be8ae688SgrantThe
19461f28255Scgd.Fl y
19561f28255Scgdoption causes
1963b3cf635Slukem.Nm
19761f28255Scgdnot to update files that are younger than the master copy.
19861f28255ScgdThis can be used
19961f28255Scgdto prevent newer copies on other hosts from being replaced.
20061f28255ScgdA warning message is printed for files which are newer than the master copy.
20161f28255Scgd.El
20261f28255Scgd.Pp
20361f28255Scgd.Ar Distfile
20461f28255Scgdcontains a sequence of entries that specify the files
20561f28255Scgdto be copied, the destination hosts, and what operations to perform
206be8ae688Sgrantto do the updating.
207be8ae688SgrantEach entry has one of the following formats.
20861f28255Scgd.Pp
20961f28255Scgd.Bd -literal -offset indent -compact
210*01869ca4Swiz<variable name> `=' <name list>
211*01869ca4Swiz[label:]<source list> `\->' <destination list> <command list>
212*01869ca4Swiz[label:]<source list> `::' <time_stamp file> <command list>
21361f28255Scgd.Ed
21461f28255Scgd.Pp
21561f28255ScgdThe first format is used for defining variables.
21661f28255ScgdThe second format is used for distributing files to other hosts.
21761f28255ScgdThe third format is used for making lists of files that have been changed
21861f28255Scgdsince some given date.
21961f28255ScgdThe
22061f28255Scgd.Ar source list
22161f28255Scgdspecifies a
22261f28255Scgdlist of files and/or directories on the local host which are to be used
22361f28255Scgdas the master copy for distribution.
22461f28255ScgdThe
22561f28255Scgd.Ar destination list
22661f28255Scgdis the list of hosts to which these files are to be
227be8ae688Sgrantcopied.
228be8ae688SgrantEach file in the source list is added to a list of changes
22961f28255Scgdif the file is out of date on the host which is being updated (second format) or
23061f28255Scgdthe file is newer than the time stamp file (third format).
23161f28255Scgd.Pp
232be8ae688SgrantLabels are optional.
233be8ae688SgrantThey are used to identify a command for partial updates.
23461f28255Scgd.Pp
23561f28255ScgdNewlines, tabs, and blanks are only used as separators and are
236be8ae688Sgrantotherwise ignored.
237be8ae688SgrantComments begin with `#' and end with a newline.
23861f28255Scgd.Pp
23961f28255ScgdVariables to be expanded begin with `$' followed by one character or
24061f28255Scgda name enclosed in curly braces (see the examples at the end).
24161f28255Scgd.Pp
24261f28255ScgdThe source and destination lists have the following format:
24361f28255Scgd.Bd -literal -offset indent
244*01869ca4Swiz<name>
24561f28255Scgd.Ed
24661f28255Scgdor
24761f28255Scgd.Bd -literal -offset indent -compact
248*01869ca4Swiz`(' <zero or more names separated by white-space> `)'
24961f28255Scgd.Ed
25061f28255Scgd.Pp
25161f28255ScgdThe shell meta-characters `[', `]', `{', `}', `*', and `?'
25261f28255Scgdare recognized and expanded (on the local host only) in the same way as
25361f28255Scgd.Xr csh 1 .
25461f28255ScgdThey can be escaped with a backslash.
25561f28255ScgdThe `~' character is also expanded in the same way as
25661f28255Scgd.Xr csh 1
25761f28255Scgdbut is expanded separately on the local and destination hosts.
25861f28255ScgdWhen the
25961f28255Scgd.Fl w
26061f28255Scgdoption is used with a file name that begins with `~', everything except the
26161f28255Scgdhome directory is appended to the destination name.
26261f28255ScgdFile names which do not begin with `/' or `~' use the destination user's
26361f28255Scgdhome directory as the root directory for the rest of the file name.
26461f28255Scgd.Pp
26561f28255ScgdThe command list consists of zero or more commands of the following
26661f28255Scgdformat.
26761f28255Scgd.Bd -ragged -offset indent -compact
26861f28255Scgd.Bl -column except_patx pattern\ listx
269*01869ca4Swiz.It `install'	<options>	opt_dest_name `;'
270*01869ca4Swiz.It `notify'	<name list>	`;'
271*01869ca4Swiz.It `except'	<name list>	`;'
272*01869ca4Swiz.It `except_pat'	<pattern list>	`;'
273*01869ca4Swiz.It `special'	<name list>	string `;'
27461f28255Scgd.El
27561f28255Scgd.Ed
27661f28255Scgd.Pp
27761f28255ScgdThe
27861f28255Scgd.Ic install
27961f28255Scgdcommand is used to copy out of date files and/or directories.
28061f28255ScgdEach source file is copied to each host in the destination list.
28161f28255ScgdDirectories are recursively copied in the same way.
28261f28255Scgd.Ar Opt_dest_name
28361f28255Scgdis an optional parameter to rename files.
28461f28255ScgdIf no
28561f28255Scgd.Ic install
28661f28255Scgdcommand appears in the command list or
28761f28255Scgdthe destination name is not specified,
28861f28255Scgdthe source file name is used.
28961f28255ScgdDirectories in the path name will be created if they
29061f28255Scgddo not exist on the remote host.
29161f28255ScgdTo help prevent disasters, a non-empty directory on a target host will
29261f28255Scgdnever be replaced with a regular file or a symbolic link.
29361f28255ScgdHowever, under the `\-R' option a non-empty directory will be removed
29461f28255Scgdif the corresponding filename is completely absent on the master host.
29561f28255ScgdThe
29661f28255Scgd.Ar options
29761f28255Scgdare `\-R', `\-h', `\-i', `\-v', `\-w', `\-y', and `\-b'
29861f28255Scgdand have the same semantics as
29961f28255Scgdoptions on the command line except they only apply to the files
30061f28255Scgdin the source list.
30161f28255ScgdThe login name used on the destination host is the same as the local host
30261f28255Scgdunless the destination name is of the format ``login@host".
30361f28255Scgd.Pp
30461f28255ScgdThe
30561f28255Scgd.Ic notify
30661f28255Scgdcommand is used to mail the list of files updated (and any errors
307035fd397Scgdthat may have occurred) to the listed names.
30861f28255ScgdIf no `@' appears in the name, the destination host is appended to
30961f28255Scgdthe name
31061f28255Scgd(e.g., name1@host, name2@host, ...).
31161f28255Scgd.Pp
31261f28255ScgdThe
31361f28255Scgd.Ic except
31461f28255Scgdcommand is used to update all of the files in the source list
31561f28255Scgd.Ic except
31661f28255Scgdfor the files listed in
31761f28255Scgd.Ar name list  .
31861f28255ScgdThis is usually used to copy everything in a directory except certain files.
31961f28255Scgd.Pp
32061f28255ScgdThe
32161f28255Scgd.Ic except_pat
32261f28255Scgdcommand is like the
32361f28255Scgd.Ic except
32461f28255Scgdcommand except that
32561f28255Scgd.Ar pattern list
32661f28255Scgdis a list of regular expressions
32761f28255Scgd(see
32861f28255Scgd.Xr ed 1
32961f28255Scgdfor details).
33061f28255ScgdIf one of the patterns matches some string within a file name, that file will
33161f28255Scgdbe ignored.
33261f28255ScgdNote that since `\e' is a quote character, it must be doubled to become
333be8ae688Sgrantpart of the regular expression.
334be8ae688SgrantVariables are expanded in
33561f28255Scgd.Ar pattern list
336be8ae688Sgrantbut not shell file pattern matching characters.
337be8ae688SgrantTo include a `$', it
33861f28255Scgdmust be escaped with `\e'.
33961f28255Scgd.Pp
34061f28255ScgdThe
34161f28255Scgd.Ic special
34261f28255Scgdcommand is used to specify
34361f28255Scgd.Xr sh 1
34461f28255Scgdcommands that are to be executed on the
34561f28255Scgdremote host after the file in
34661f28255Scgd.Ar name list
34761f28255Scgdis updated or installed.
34861f28255ScgdIf the
34961f28255Scgd.Ar name list
35061f28255Scgdis omitted then the shell commands will be executed
351be8ae688Sgrantfor every file updated or installed.
352be8ae688SgrantThe shell variable `FILE' is set
35361f28255Scgdto the current filename before executing the commands in
35461f28255Scgd.Ar string  .
35561f28255Scgd.Ar String
35661f28255Scgdstarts and ends with `"' and can cross multiple lines in
35761f28255Scgd.Ar distfile .
35861f28255ScgdMultiple commands to the shell should be separated by `;'.
35961f28255ScgdCommands are executed in the user's home directory on the host
36061f28255Scgdbeing updated.
36161f28255ScgdThe
36261f28255Scgd.Ar special
36361f28255Scgdcommand can be used to rebuild private databases, etc.
36461f28255Scgdafter a program has been updated.
36561f28255Scgd.Pp
36661f28255ScgdThe following is a small example:
36761f28255Scgd.Bd -literal -offset indent
36861f28255ScgdHOSTS = ( matisse root@arpa )
36961f28255Scgd
37061f28255ScgdFILES = ( /bin /lib /usr/bin /usr/games
37161f28255Scgd\t/usr/include/{*.h,{stand,sys,vax*,pascal,machine}/*.h}
37261f28255Scgd\t/usr/lib /usr/man/man? /usr/ucb /usr/local/rdist )
37361f28255Scgd
374a5bfdf78ScgdEXLIB = ( Mail.rc aliases aliases.dir aliases.pag crontab dshrc
375a5bfdf78Scgd\tsendmail.cf sendmail.fc sendmail.hf sendmail.st uucp vfont )
37661f28255Scgd
377*01869ca4Swiz${FILES} -> ${HOSTS}
37861f28255Scgd\tinstall -R ;
37961f28255Scgd\texcept /usr/lib/${EXLIB} ;
38061f28255Scgd\texcept /usr/games/lib ;
38161f28255Scgd\tspecial /usr/lib/sendmail "/usr/lib/sendmail -bz" ;
38261f28255Scgd
38361f28255Scgdsrcs:
384*01869ca4Swiz/usr/src/bin -> arpa
38561f28255Scgd\texcept_pat ( \e\e.o\e$ /SCCS\e$ ) ;
38661f28255Scgd
38761f28255ScgdIMAGEN = (ips dviimp catdvi)
38861f28255Scgd
38961f28255Scgdimagen:
390*01869ca4Swiz/usr/local/${IMAGEN} -> arpa
39161f28255Scgd\tinstall /usr/local/lib ;
39261f28255Scgd\tnotify ralph ;
39361f28255Scgd
39461f28255Scgd${FILES} :: stamp.cory
39561f28255Scgd\tnotify root@cory ;
39661f28255Scgd.Ed
39761f28255Scgd.Sh FILES
39861f28255Scgd.Bl -tag -width /tmp/rdist* -compact
39961f28255Scgd.It Pa distfile
40061f28255Scgdinput command file
40161f28255Scgd.It Pa /tmp/rdist*
40261f28255Scgdtemporary file for update lists
40361f28255Scgd.El
404fd16df70Swiz.Sh DIAGNOSTICS
405fd16df70SwizA complaint about mismatch of rdist version numbers may really stem
406fd16df70Swizfrom some problem with starting your shell, e.g., you are in too many groups.
40761f28255Scgd.Sh SEE ALSO
40861f28255Scgd.Xr csh 1 ,
409fd16df70Swiz.Xr sh 1 ,
41061f28255Scgd.Xr stat 2
41161f28255Scgd.Sh HISTORY
41261f28255ScgdThe
4133b3cf635Slukem.Nm
41461f28255Scgdcommand appeared in
41561f28255Scgd.Bx 4.3 .
41661f28255Scgd.Sh BUGS
41761f28255ScgdSource files must reside on the local host where
4183b3cf635Slukem.Nm
41961f28255Scgdis executed.
42061f28255Scgd.Pp
42161f28255ScgdThere is no easy way to have a special command executed after all files
42261f28255Scgdin a directory have been updated.
42361f28255Scgd.Pp
42461f28255ScgdVariable expansion only works for name lists; there should be a general macro
42561f28255Scgdfacility.
42661f28255Scgd.Pp
4273b3cf635Slukem.Nm
42861f28255Scgdaborts on files which have a negative mtime (before Jan 1, 1970).
42961f28255Scgd.Pp
43061f28255ScgdThere should be a `force' option to allow replacement of non-empty directories
431be8ae688Sgrantby regular files or symlinks.
432be8ae688SgrantA means of updating file modes and owners
43361f28255Scgdof otherwise identical files is also needed.
434