|
|
automount provides for the use of environment variables within a direct, indirect, or master map entry. Using environment variables is helpful for users who wish to manage automount maps with NIS. The advantage of using NIS is being able to maintain a single map for distribution to multiple clients. If such a map requires a value that varies from client to client, it can be replaced by an environment variable. This allows several clients to use the same map entry but still be mounted on different servers.
Environment variables can be used by prepending a dollar sign ($) to the name of the variable. Braces are used to delimit the name of the environment variable from appended letters or digits. These variables can be used anywhere in an entry line, except as a key.
Environment variables can either be inherited from the environment or can be defined explicitly with the -D command-line option. For instance, if you want each client to mount client-specific files in the network in a replicated format, create a specific map for each client according to its name, so that the relevant line for host milan is:
/mystuff acapulco,tokyo,sydney:/export/hostfiles/milanFor moscow it is:
/mystuff acapulco,tokyo,sydney:/export/hostfiles/moscowThis scheme is viable within a small network, but maintaining this kind of host-specific map across a large network would soon become unfeasible. The solution in this case is to start automount with a command line similar to:
The entry in the direct map should read:
/mystuff acapulco,tokyo,sydney:/export/hostfiles/$HOSTNow each host finds its own files in the mystuff directory, and the task of centrally administering and distributing the maps becomes easier.
See also: