13.07.2015 Views

Naming and Directory Services (DNS, NIS, and LDAP)

Naming and Directory Services (DNS, NIS, and LDAP)

Naming and Directory Services (DNS, NIS, and LDAP)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

To periodically run ypxfr at a rate appropriate for the map, the root crontab file oneach slave server should contain the appropriate ypxfr entries. ypxfr contacts themaster server <strong>and</strong> transfers the map only if the copy on the master server is morerecent than the local copy.Note – If your master server runs rpc.yppasswdd with the default -m option, theneach time someone changes their yp password, the passwd daemon runs make, whichrebuilds the passwd maps.Using Shell Scripts With cron <strong>and</strong> ypxfrAs an alternative to creating separate crontab entries for each map, you might preferto have the root crontab comm<strong>and</strong> run a shell script that periodically updates allmaps. Sample map-updating shell scripts are n the /usr/lib/netsvc/yp directory.The script names are ypxfr_1perday, ypxfr_1perhour, <strong>and</strong> ypxfr_2perday.You can modify or replace these shell scripts to fit your site requirements. Example 6–1shows the default ypxfr_1perday shell script.EXAMPLE 6–1 ypxfr_1perday Shell Script#! /bin/sh## ypxfr_1perday.sh - Do daily yp map check/updatesPATH=/bin:/usr/bin:/usr/lib/netsvc/yp:$PATHexport PATH# set -xvypxfr group.bynameypxfr group.bygidypxfr protocols.bynameypxfr protocols.bynumberypxfr networks.bynameypxfr networks.byaddrypxfr services.bynameypxfr ypserversThis shell script updates the maps once per day, if the root crontab is executed daily.You can also have scripts that update maps once a week, once a month, once everyhour, <strong>and</strong> so forth, but be aware of the performance degradation implied in frequentlypropagating the maps.Run the same shell scripts as root on each slave server configured for the <strong>NIS</strong> domain.Alter the exact time of execution from one server to another to avoid bogging downthe master.If you want to transfer the map from a particular slave server, use the -h machineoption of ypxfr within the shell script. Here is the syntax of the comm<strong>and</strong>s you putin the script.Chapter 6 • Administering <strong>NIS</strong> (Tasks) 105

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!