This document describes the old AIX rdist command located in the usr/bin/rdist file as well as the new usr/sbin/rdist command which is used with the new rdistd daemon.
Remote file distribution client program
rdist [ -n ] [ -q ] [ -b ] [ -D ] [ -R ] [ -h ] [ -i ] [ -v ] [ -w ] [ -y ] [ -f FileName ] [ -d Argument=Value ] [ -m Host ] ... [ Name ] ...
rdist [ -n ] [ -q ] [ -b ] [ -D ] [ -R ] [ -h ] [ -i ] [ -v ] [ -w ] [ -y ] -c Name ... [ Login@ ] Host [ :Destination ]
The rdist command maintains identical copies of files on multiple hosts. The rdist command preserves the owner, group, mode, and modified time of files, if possible, and can update programs that are running. The rdist command can receive direction from the following sources:
If you do not use the -f flag, the rdist command looks for the distfile file in your $HOME directory. If it doesn't find a distfile file, it looks for Distfile file.
The value specified by the Name parameter is read as the name of a file to be updated or a subcommand to execute. If you do not specify a value for the Name parameter on the command line, the rdist command updates all the files and directories listed in the distribution file. If you specify - (minus sign) for the Name parameter, the rdist command uses standard input. If the name of a file specified by the Name parameter is the same as the name of a subcommand, the rdist command interprets the Name parameter as a subcommand.
The rdist command requires that a .rhosts file be configured on each host. See ".rhosts File Format for TCP/IP" in AIX 5L Version 5.2 Files Reference for details.
The distribution file specifies the files to copy, destination hosts for distribution, and operations to perform when updating files to be distributed with the rdist command. Normally, the rdist command uses the distfile file in your $HOME directory. You can specify a different file If you use the -f flag.
Each entry in the distribution file has one of the following formats:
Labels are optional and used to identify a subcommand for partial updates.
The rdist command treats new-line characters, tabs, and blanks as separators. Distribution file variables for expansion begin with a $ (dollar sign) followed by a single character or a name enclosed in {} (braces). Comments begin with a # (pound sign) and end with a new-line character.
The distribution file source and destination lists comprise zero or more names separated by blanks, as shown in the following format:
[Name1] [Name2] [Name3] ...
The rdist command recognizes and expands the following shell metacharacters on the local host in the same way as for the csh command.
To prevent these characters from being expanded, precede them with a \ (backslash). The rdist command also expands the ~ (tilde) in the same way as for the csh command, but does so separately on the local and destination hosts.
Multiple commands to the shell must be separated by a ; (semicolon). Commands are executed in the user's home directory on the host being updated. The special subcommand can be used to rebuild private databases after a program has been updated.
The distribution file subcommand list may contain zero or more of the following subcommands:
This command returns the following exit values:
0 | Successful completion. |
>0 | Specifies that an error occurred. |
HOSTS =( matisse root@arpa )
where the HOSTS variable is defined to be matisse and root@arpa. The rdist command updates files on the hosts matisse and root@arpa. You could use this variable as a destination list.
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 )
where the FILES value is defined to be the files to be used for the SourceList entry.
EXLIB = ( Mail.rc aliases aliases.dir aliases.pag crontab dshrc sendmail.cf sendmail.fc sendmail.hf sendmail.st uucp vfont)
where the EXLIB value is defined as a list of files to exclude from the updating process.
/usr/src/bin ->arpa except_pat(\e\e.o\e ${<namelist> /SCCS\e ${<namelist>}
or
/usr/src/bin ->arpa except_pat(\\.o\e ${<namelist> /SCCS\e ${<namelist>}
/usr/src/bin ->arpa except_pat(\\.o\$ /SCCS\$
${FILES} ->${HOSTS} install -R except /usr/lib/${EXLIB} ; except /usr/games/lib ; special /usr/sbin/sendmail "/usr/sbin/sendmail.bz" ;
The [Label:] entry of the line is optional and not shown here. The $ (dollar sign) and the {} (braces) cause the file names FILES, HOSTS, and EXLIB to be expanded into the lists designated for them in the previous examples. The rest of the example comprises the subcommand list.
srcsL: /usr/src/bin -> arpa except_pat (\e\e.o\e$ /SCCS\e$ ) ;
The label is srcsL: and can be used to identify this entry for updating. The /usr/src/bin file is the source to be copied and host arpa is the destination of the copy. The third line contains a subcommand from the subcommand list.
${FILES} :: stamp.cory notify root@cory
The $ (dollar sign) and {} (braces) cause the name specified by FILES to be expanded into the list designated for it. The time-stamp file is stamp.cory. The last line is a subcommand from the subcommand list.
/usr/bin/rdist | Contains the rdist command. |
$HOME/distfile | Contains a list of subcommands to be read by the rdist command. |
/tmp/rdist | Contains an update list. This is a temporary file. |
The csh command, ksh command, sh command.
The .rhosts file format.
Network Overview in AIX 5L Version 5.2 System Management Guide: Communications and Networks.
Client program for distributing files remotely.
/usr/sbin/rdist [ -Fn ] [ -A num ] [ -a num ] [ -d var=value] [ -l < local logopts> ] [ -L <remote logopts> ] [ -f distfile] [ -M maxproc -m host ] [ -o distops ] [ -t timeout ] [ -p <rdist-path> ] [ -P <transport-path> ] [ name ... ]
/usr/sbin/rdist -Fn -c name ... [ login@ ] host [ :dest ]
/usr/sbin/rdist -Server
/usr/sbin/rdist -V
rdist is a program to maintain identical copies of files over multiple hosts. It preserves the owner, group, mode, and modification time of files if possible and can update programs that are running. The rdist command can receive direction from the following sources:
( filename ... ) -> [user@]host install [dest name] ;
If no name arguments are specified, rdist will update all of the files and directories listed in distfile. Otherwise, the argument is taken to be the name of a file to be updated or the label of a command to execute. If the label and file names conflict, it is assumed to be a label. These may be used together to update specific files using specific commands.
The -Server option provides backward compatibility for older versions of rdist which used this option to put rdist into server mode. If rdist is started with the -Server command line option, it will attempt to run the old version of rdist. This option will only work if the old rdist is located at /usr/bin/rdist.
rdist uses an arbitrary transport program to access each target host. The transport program can be specified on the command line with the -P flag. If the -P flag is not used, rsh is taken as the transport program. If the rsh method is used and the target host is the string localhost and the remote user name is the same as the local user name, rdist will attempy to run the following command:
/bin/sh -c rdistd -S
Otherwise rdist will run the following command:
rsh host -l remuser rdistd -S
In the example above, the host parameter is the name of the target host, remuser is the name of the user to make the connection as and, rdistd is the rdist server command on the target host.
The transport program must be compatible with the above syntax for rsh. If not, the transport program should be wrapped in a shell script which understands this command line syntax.
On each target host rdist will attempt to run the following command:
rdistd -S
or
<rdistd path> -S
In the example above, the -p flag was specified. If -p flag is not included, or the <rdistd path> is a simple filename, rdistd or <rdistd path> must be somewhere in the PATH of the user running rdist on the remote (target) host.
The rdist command uses the following environment variables:
TMPDIR | Name of temporary directory to use. Default is /tmp. |
-A num | Update or install files only if a minimum number of free files (inodes) exists on a filesystem. |
-a num | Update or install files only if a minimum amount of free space exists on a filesystem. |
-d var = value | Assign value to variable var. This option is used to define or override variable definitions in the distfile. Value can be the empty string, one name, or a list of names surrounded by parentheses and separated by tabs and/or spaces. |
-F | Update all clients sequentially without forking child processes. |
-f distfile | Use distfile as the distribution file. If distfile is specified as -, read from standard input. |
-l logopts | Sets local logging options. See the Message Logging section for more information on the syntax for logopts. |
-L logopts | Sets remote logging options. logopts is the same as for local logging except the values are passed to the remote server (rdistd ). See the Message Logging section for more information on the syntax of logopts. |
-M num | Limit the maximum number of simultaneously running child rdist processes to num. The default is 4. |
-m machine | Limits the updating of files to the given machine. Multiple -m arguments can be given to limit updates to a subset of the hosts listed in the distfile. |
-n | Display but do not execute commands. Use the -n flag to debug distfile. |
-o distopts | Specifies the dist options to enable. distopts is
a comma separated list of options listed below. The valid values for distopts are:
|
-o distopts | (dist options, continued):
|
-p <rdist-path> | Search for the rdistd server in the given path on the target host. |
-P <rdist-path> | Use the transport program as given in transport-path. The transport-path may be a colon seperated list of possible pathnames. In this case, the first component of the path to exist is used. |
-t timeout | Sets the timeout period (in seconds) for waiting for responses from the remote rdist server. The default is 900 seconds. |
-V | Prints the version information and exits. |
The rdist command provides a set of message facilities, each of which contains a list of message types specifying which types of messages to send to that facility. The local client (rdist) and the remote server (rdistd) each maintain separate copies of what types of messages to log to what facilities.
The -l logopts flag specifies what logging options to use locally on the client. The -L logopts flag specifies what logging options to pass to the remote rdistd server.
The form of logopts should be the following:
facility=types:facility= types...
The valid facility names are as follows:
types should be a comma separated list of message types. Each message type specified enables that message level. This is unlike the syslog system facility which uses an ascending order scheme. The following are the valid types:
The distribution file specifies the files to copy, destination hosts for distribution, and operations to perform when updating files to be distributed with the rdist command.
Each entry in the distribution file has one of the following formats:
VariableName = NameList | Defines variables used in other entries of the distribution file (SourceList, DestinationList, or SubcommandList). |
[Label:] SourceList -> DestinationList SubcommandList | Directs the rdist command to distribute files named in the SourceList variable to hosts named in the DestinationList variable. Distribution file commands perform additional functions. |
[Label:] SourceList :: TimeStampFile SubcommandList | Directs the rdist command to update files that have changed since a given date. Distribution file subcommands perform additional functions. Each file specified with the SourceList variable is updated if the file is newer than the time-stamp file. |
Labels are optional. They are used to identify a command for partial updates.
VariableName | Identifies the variable used in the distribution file. |
NameList | Specifies a list of files and directories, hosts, or subcommands. |
SourceList | Specifies files and directories on the local host for the rdist command to use as the master copy for distribution. |
DestinationList | Indicates hosts to receive copies of the files. |
SubcommandList | Lists distribution file subcommands to be executed. |
The rdist command treats newline characters, tabs, and blanks as separators. Distribution file variables for expansion begin with a dollar sign followed by a single character or a name enclosed in braces. Comments begin with a pound sign and end with a newline character.
The distribution file source and destination lists comprise zero or more names separated by blanks, as shown in the following format:
[Name1] [Name2] [Name3] ...
The rdist command recognizes and expands the following shell metacharacters on the local host in the same way as for the csh command.
To prevent these characters from being expanded, precede them with a backslash. The rdist command also expands the tilde in the same way as for the csh command, but does so separately on the local and destination hosts. When the -o whole option is used with a file name that begins with a tilde, everything except the home directory is appended to the destination name. File names which do not begin with a forward slash or a tilde use the destination user's home directory as the root directory for the rest of the file name.
Multiple commands to the shell must be separated by a semicolon. Commands are executed in the user's home directory on the host being updated. The special subcommand can be used to rebuild private databases after a program has been updated.
The distribution file subcommand list may contain zero or more of the following subcommands:
install Options[OptionalDestName]; | Copies out-of-date files and directories.
The rdist command copies each source
file or directory to each host in the destination list. The available options
as specified by the Options variable are the rdist command flags -b, -h, -i, -R, -v, -w, and -y. These options only apply
to the files specified by the SourceList variable.
When you use the -R flag, nonempty directories are removed
if the corresponding file name is absent on the master host. The OptionalDestName parameter renames files.
If no install subcommand appears in the subcommand list or the destination name is not specified, the source file name is used. Directories in the path name are created if they do not exist on the remote host. 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 NameList; | Mails the list of updated files and any errors that may have occurred to the listed names (the NameList parameter). If no @ (at sign) appears in the name, the destination host is appended to the name (name@host). |
except NameList; | Causes the rdist command to update all the files specified by the SourceList entry except for those files specified by the NameList variable. |
except_pat NameList; | Prevents the rdist command from updating any files that contain a string that matches a member of the list specified by the NameList variable. |
special NameList "String"; | Specifies shell commands (the "String" variable) to be executed on the remote host after the file specified by the NameList variable is updated or installed. If the NameList variable is omitted, the shell commands are executed for every file updated or installed. The shell variable FILE is set to the current file name before the rdist command executes the "String" variable, the variable REMFILE will contain the full pathname of the remote file that was just updated and the variable BASEFILE will contain the basename of the remote file that was just updated. The "String" value must be enclosed in double quotation marks and can cross multiple lines in the distribution file. |
cmdspecial NameList "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 shell variable FILES will contain the list of files. Each file name in the FILES shell variable is separated by a colon. |
NFS checks are disabled if a hostname ends in a plus sign. This is equivalent to disabling the -o chknfs option just for this one host.
This command returns the following exit values:
0 | Successful completion. |
>0 | An error occurred. |
HOSTS =( matisse root@arpa )
In the above example, the HOSTS variable is defined to be matisse and root@arpa. The rdist command updates files on the hosts matisse and root@arpa. You could use this variable as a destination list.
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 )
In the above example, the FILES value is defined to be the files to be used for the SourceList entry.
EXLIB = ( Mail.rc aliases aliases.dir aliases.pag crontab dshrc sendmail.cf sendmail.fc sendmail.hf sendmail.st uucp vfont)
In the above example, the EXLIB value is defined as a list of files to exclude from the updating process.
/usr/src/bin ->arpa except_pat(\e\e.o\e ${<namelist> /SCCS\e ${<namelist>}
or
/usr/src/bin ->arpa except_pat(\\.o\e ${<namelist> /SCCS\e ${<namelist>}
/usr/src/bin ->arpa except_pat(\\.o\$ /SCCS\$
${FILES} ->${HOSTS} install -R except /usr/lib/${EXLIB} ; except /usr/games/lib ; special /usr/sbin/sendmail "/usr/sbin/sendmail.bz" ;
The [Label:] entry of the line is optional and not shown here. Thedollar sign and the braces cause the file names FILES, HOSTS, and EXLIB to be expanded into the lists designated for them in the previous examples. The rest of the example comprises the subcommand list.
srcsL: /usr/src/bin -> arpa except_pat (\e\e.o\e$ /SCCS\e$ ) ;
The label is srcsL: and can be used to identify this entry for updating. The /usr/src/bin file is the source to be copied and host arpa is the destination of the copy. The third line contains a subcommand from the subcommand list.
${FILES} :: stamp.cory notify root@cory
The dollar sign and braces cause the name specified by FILES to be expanded into the list designated for it. The time-stamp file is stamp.cory. The last line is a subcommand from the subcommand list.
/usr/sbin/rdist | Contains the rdist command at version 6.1.5. |
distfile | Contains the input commands. |
$ TMPDIR/rdist* | The temporary file for update lists. |
The csh command, rcmd() system call, rdistd command,rsh command, sh command, stat() system call.