DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Distributing files remotely over TCP/IP

Writing a distfile

The distfile contains a sequence of entries that specify the files to be copied, the destination hosts, and what operations to perform to do the updating. Each entry has one of the following formats:


variable_name = name_list
Used for defining variables.

[label: ] source_list -> destination_list command_list
Used for distributing files to other hosts. source_list specifies a list of files and/or directories on the local host that are to be used as the master copy for distribution. Each file in the source_list is added to a list of changes if the file is out of date on the host that is being updated.

[ label: ] source_list :: time_stamp_file command_list
Used for making lists of files that have been changed since some given date. Each file in the source_list is added to a list of changes if the file is newer than the timestamp file.
The source and destination lists have one of these two formats:

name
( zero_or_more_names_separated_by_white_space )

If additional modifications are needed (for example, ``all servers and client machines except for the OSF/1 machines''), then the list will have to be explicitly constructed in steps using ``temporary'' variables.

The shell meta-characters ``['', ``]'', ``{'', ``}'', ``*'', and ``?'' are recognized and expanded (on the local host only) in the same way as csh(C). They can be escaped with a backslash. The ``~'' character is also expanded in the same way as csh but is expanded separately on the local and destination hosts. When the -owhole option is used with a filename that begins with ``~'', everything except the home directory is appended to the destination name. File names that do not begin with ``/'' or ``~'' use the destination user's home directory as the root directory for the rest of the file name.

The command list consists of zero or more commands with the following formats:


install options opt_dest_name
The install command is used to copy out-of-date files and/or directories. Each source file is copied to each host in the destination list. Directories are recursively copied in the same way. opt_dest_name is an optional parameter to rename files. If no install command appears in the command list or the destination name is not specified, the source filename is used. Directories in the pathname will be created if they do not exist on the remote host. The -odistopts option has the same semantics as on the command line except they only apply to the files in the source list. The login name used on the destination host is the same as the local host unless the destination name is of the format ``login@host''.

notify name_list
The notify command is used to mail the list of updated files (and any errors that may have occurred) to the listed names. If no ``@'' appears in the name, the destination host is appended to the name (for example, name1@host, name2@host, ...).

except name_list
The except command is used to update all of the files in the source list except for the files listed in name_list. This is usually used to copy everything in a directory except certain files.

except_pat pattern_list
The except_pat command is like the except command except that pattern_list is a list of regular expressions (see the ed(C) manual page for details). If one of the patterns matches some string within a filename, that file will be ignored. Note that since ``\'' is a quote character, it must be doubled to become part of the regular expression. Variables are expanded in pattern_list but not shell file pattern matching characters. To include a ``$'', it must be preceded by the escape character ``\''.

special name_list string
The special command is used to specify sh(C) commands that are to be executed on the remote host after the file in name_list is updated or installed. If the name_list is omitted, then the shell commands will be executed for every file updated or installed. string starts and ends with ``"'' and can cross multiple lines in distfile. Multiple commands to the shell should be separated with ``;''. Commands are executed in the user's home directory on the host being updated. The special command can be used to rebuild private databases, and so forth, after a program has been updated. The following environment variables are set for each special command:

FILE
the full pathname of the local file that was just updated

REMFILE
the full pathname of the remote file that was just updated

cmdspecial name_list string
The cmdspecial command is similar to the special command, except it is executed only when the entire command is completed instead of after each file is updated. The list of files is placed in the environment variable $FILES. Each filename in $FILES is separated by a ``;'' (semicolon).
If a hostname ends in a ``+'', rdist strips it off and disables NFS checking. This is equivalent to disabling the -ochknfs option for this host.

Here is a small example:

A sample distfile

   HOSTS = ( yukon root@arpa)
   

FILES = ( /bin /lib /usr/bin /usr/games /usr/include/{*.h,{stand,sys,vax*,pascal,machine}/*.h} /usr/lib /usr/man/man? /usr/ucb /usr/local/rdist )

EXLIB = ( Mail.rc aliases aliases.dir aliases.pag crontab dshrc sendmail.cf sendmail.fc sendmail.hf sendmail.st uucp vfont )

${FILES} -> ${HOSTS} install -oremove,chknfs ; except /usr/lib/${EXLIB} ; except /usr/games/lib ; special /usr/lib/sendmail "/usr/lib/sendmail -bz" ;

srcs: /usr/src/bin -> arpa except_pat ( \\.o\$ /SCCS\$ ) ;

IMAGEN = (ips dviimp catdvi)

imagen: /usr/local/${IMAGEN} -> arpa install /usr/local/lib ; notify ralph ;

${FILES} :: stamp.cory notify root@cory ;


Next topic: Using rdist
Previous topic: New rdist features

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003