Information Technology Reference
In-Depth Information
servers (using the
yypush
utility). The following listing shows the commands
used to update the hosts map and propagate it to slave servers:
# cd /var/yp
# make hosts
To add a new map (referred to as a
nondefault map
), create a text file in the
/var/yp
directory on the master server with the appropriate information.
Then run the
makedbm(1M)
command to add the map. The
makedbm
com-
mand expects two command-line arguments. The first is the name of the
source file, and the second is the name of the map that should be created.
The
ypxfr
(1M) command is used to distribute a new map that does not cur-
rently exist on the slave servers. The name of the new map is specified as a
command-line argument. The following shows creating the new map,
apps
,
from the apps.txt source file:
# cd /var/yp
# makedbm apps.txt apps
# /usr/lib/netsvc/yp/ypxfr apps
To update and propagate a nondefault map, edit the source file, and then run
the
makedbm
command to rebuild the map. To propagate the updated map,
use the
yppush(1M)
command and specify the map name as a command-line
argument. The following shows rebuilding the apps map from the apps.txt
source file and propagating it to the
slave
servers:
# cd /var/yp
# makedbm apps.txt apps
# /usr/lib/netsvc/yp/yppush apps
An alternative procedure for maintaining nondefault maps is to modify the
Makefile
under
/var/yp
to include entries for the nondefault maps. This
would allow nondefault maps to be updated and propagated using the same
procedure as the default maps.
Each map managed using the default map procedure has a
Makefile
entry.
The name of the entry is
file.time
, whereby
file
is the name of the text file
that contains the information used to create the map. The
Makefile
entry
should be copied from an existing entry and modified to use the appropriate
source files as input, perform the necessary editing and generate the appro-
priate output files. In addition, a file by the name of
file
.time
must exist
under the
/var/yp
directory, which is used as a timestamp of when the map
was last updated. When the
Makefile
entry is invoked, the modification time
of source file is compared to the map timestamp, and if the source file is
newer, the map is rebuilt and propagated.