Am Donnerstag, 21. Juni 2001 19:37 schrieb Oakham, Geoff: > How do executable maps work? For now I'm using a perl script that does > more or less what you described (but it also makes symbolic links.) This > kind of hack (even if it's not pretty) would be nice placeholder for real > direct map support in autofs. Executable Maps are just programs the automounter calls to resolve a key to a map entry. Look at "man 5 autofs" for a short description. An direct map entry should look like the following: # Make mail spooling dir of server "mail" available for all clients /var/spool/mail -noac mail:/var/spool/mail The Executable Map we are writing should be run on e.g. /auto. What we need are symlinks in the correct places in our system. The only possibility, I can see, is a cron job that reads NIS information. This script should convert the key to a file name. Let's say _var_spool_mail. Now we should make a symlink: /var/spool/mail -> /auto/_var_spool_mail Now we should write a bash script that will be run as Executable Map on /auto. This script will get the key the automounter is looking for as $1. In the example: The user enters /var/spool/mail. The system follows the symlink and will contact the automounter. The automounter calls our script with _var_spool_mail as key. First we have to revert this key to /var/spool/mail. Now we can lookup NIS via ypmatch and search for the entry. If it doesn't exist just return 1. If it exists, like in the example, we just return the entry: -noac mail:/var/spool/mail Now the automounter will mount the entry. Would you should think about is the following: The Executable Map is called every time someone is looking for a file in /auto! The first idea one could have is using a Perl script as Executable Map. But think about it! Every time you look for a file Perl will be started! This is not really the best solution. You could write a C programm. That would made the best performance possible. But I think a shell script is much better. It will result in a short map and it should not take long to start a shell. Perhaps you can even use the ash or even sash. I wrote Executable Maps for sh, because we're running Solaris that has a real sh. But remember: A lot of shell commands are external programms that are called! If you use e.g. a lot of sed calls, perhaps Perl would be an even better idea... Jochen
