Using cron to propagate maps
Maps have differing rates of change; for instance, protocols.byname
might not change for a long time, but passwd.byname
might change several times a day in a large organization.
You can set up root's
crontab(C)
entries to run ypxfr
periodically at a rate appropriate for any map in an NIS database.
The ypxfr program contacts the master server
and transfers the map only if the master's
copy is more recent than the local copy.
To avoid a crontab entry for each map, group several maps into a shell script that can be run from a single crontab script file. Each shell script should contain maps with approximately the same characteristics. The following suggested groupings, mnemonically named, can be found in /etc/yp: ypxfr1phr (hourly), ypxfr1pdy (once daily), and ypxfr2pdy (twice daily). If the rates of change are inappropriate for a particular environment, you can easily modify or replace these shell scripts. The following crontab entries will call the scripts:
0 * * * * /etc/yp/ypxfr1phr 0 0 * * * /etc/yp/ypxfr1pdy 0 0,12 * * * /etc/yp/ypxfr2pdy
Run the same shell scripts at each NIS slave and copy-only server in the domain; do not run them from the master server. Alter the time of execution from one server to another to prevent the checking from impeding the master server. To transfer the map from a particular server, rather than the master server, use the -h option to ypxfr from within the shell script. You can check and transfer maps having unique change characteristics by explicit invocations of ypxfr within crontab.
See also: