DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Setting up NIS

Using shell scripts with ypxfr

As an alternative to creating separate crontab(1) entries for each map, you may prefer to have root's crontab periodically run shell scripts that update all the maps. There are sample map-updating shell scripts, xpxfr_1perday, xpxfr_1perhour, and xpxfr_2perday, in the directory /var/yp. You can easily modify these shell scripts to fit your site's requirements, or replace them. Here is a sample default xpxfr_1perday shell script:

   #! /sbin/sh
   #
   # ypxfr_1perday.sh - Do daily yp map check/updates
   #
   

PATH=/bin:/usr/bin:/usr/sbin:$PATH export PATH

# set -xv ypxfr group.byname ypxfr group.bygid ypxfr protocols.byname ypxfr protocols.bynumber ypxfr networks.byname ypxfr networks.byaddr ypxfr services.byname ypxfr ypservers

This shell script will update once per day the maps mentioned in it, as long as root's crontab executes it once a day (preferably at times of low network load). You can also have scripts update maps once a week, once a month, once every hour, and so on, but be aware of the performance degradation implied in propagating the maps.

Run the same shell scripts through root's crontab on each slave server configured for the NIS domain. Stagger the exact time of execution from one server to another to avoid bogging down the master.

If you want to transfer the map from a particular slave server, use the -h host option of ypxfr(1Mnis) within the shell script. The syntax of the commands you put in the script is:

/usr/sbin/ypxfr -h [ -c ] host mapname

where host is the name of the server with the maps you want to transfer, and mapname is the name of the requested map. If you use the -h option without specifying host, ypxfr will try to get the map from the master server. If ypserv is not running locally at the time ypxfr is executed, you must use the -c flag.

You can use the -s domain option to transfer maps from another domain to your local domain. These maps should preferably remain the same across domains. For example, two NIS domains might share the same services.byname and services.byaddr maps. Alternately, you can use rcp(1tcp), or rdist(1Mtcp) for more control, to transfer files across domains.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004