|
|
Installing and Administering Internet Services: HP 9000 Networking > Chapter 10 Using rdistCreating the Distfile |
|
The distfile used by the master host contains a sequence of entries that specify the files to be copied, the destination hosts, and the operations to be performed to do the updating. Since a distfile is an ASCII file, you can create it with any text editor. If you are familiar with the make program, the structure of a distfile is somewhat similar to a makefile. The following syntax rules apply:
A distfile contains the following types of entries:
Each of these types of entries is described in the following sections. Variables can be used to represent a list of items, such as the names of files to be distributed or the remote hosts to be updated. Variables can be defined anywhere in the distfile, but they are usually grouped together at the beginning of the file. Variables are then used in command entries. The format for defining variables is:
variable_name is a name by which the variable is referenced. name_list consists of item names separated by white space, enclosed in parentheses. Spaces or tabs immediately to the left and right of the "=" are ignored. Subsequent appearances of ${variable_name} in the distfile (except in comments) are replaced by name_list. (Braces can be omitted if variable_name consists of just one character.) Variable definitions can also be specified in the command line when invoking rdist; variable definitions in the command line override definitions in the distfile (see “Starting rdist”). The following are examples of three variable definition entries in a distfile:
The first entry defines the variable HOSTS to represent two remote hosts, matisse and arpa, that are to be updated. Note that if a remote host is specified in the form user@host, user is the user name on host that is used to update files and directories on that host. Otherwise, the user name on the master host is used to update the remote host. The second entry defines the variable FILES to represent the files and directories to be updated on the remote hosts. The shell meta characters {, }, and * in the second line of this entry are used in a "shorthand" that represents the files /usr/include/*.h, /usr/include/stand/*.h, /usr/include/sys/*.h, /usr/include/vax*/*.h, etc. The * character is used as a wildcard. Note that you can use commands, such as cat, within single backquotes (`) in the variable list. The last entry defines the variable EXLIB to represent the files that should not be updated on the remote hosts. Examples of how variables are used in distfile command entries are shown in the following sections. Distfile command entries that distribute files to a remote host are specified in the following format:
label: is optional and is used to group command entries. You can use labels to perform a partial update. Normally, rdist updates all the files and directories listed in a distfile. You can invoke rdist with a specific label; in this case, rdist executes only the entries under the specified label. source_list specifies the directories or files on the master host that are to be used as the master copy for distributing to the remote hosts. destination_list specifies the list of remote hosts to which source_list is to be distributed. source_list and destination_list can consist of the following:
command_list consists of one or more of the commands listed in Table 10-1 “Distfile Commands”. Each command must end in a semicolon (;). Table 10-1 Distfile Commands
If there is no install command in a distfile or if the destpath option is not used with the install command, the name of the file on the master host is given to the remote host's file. Parent directories in a file's path are created on a remote host if they do not exist. rdist does not replace non-empty directories on a remote host. However, if the -R option is specified with the install command, a non-empty directory is removed on the remote host if the corresponding directory does not exist on the master host. For a detailed description of commands and their options, type man 1 rdist at the HP-UX prompt. The following two examples of file distribution commands use the variable definitions that were shown previously:
The first example distributes the source files defined in the variable FILES to the destination hosts defined in the variable HOSTS. rdist copies the files to each remote host, removing files in the remote host's directory that do not exist on the master directory. rdist does not update files in /usr/lib/${EXLIB} or in /usr/games/lib. The second example (labeled srcs) distributes the directory /usr/src/bin to the host arpa; object files or files that are under SCCS control are not copied. The third type of distfile entry is used to make a list of files that have been changed on the master host since a specified date. The format for this type of entry is as follows:
label: and source_list are specified in the same manner as in the entries to distribute files. timestamp_file is a file on the local host, whose modification time is used as a timestamp. source_list files on the local host that are newer than the timestamp are noted in a list. Use the notify command to mail the list of changed files to a specified user. The following is an example of this type of entry:
In the above example, the list of files that are newer than the timestamp in stamp.cory are mailed to the user root@cory. Note that with the notify command, if no "@" appears in the user name, the remote host name is assumed. |
|