An executable map has its entries generated dynamically by
a program or a script. AutoFS determines whether a map is executable
by checking whether the execute bit is set in its permissions string. If a map
is not executable, make sure its execute bit is not set.
When the AutoFS daemon locates a map and detects that its execute bit is set, then instead of
opening the file and searching for an entry, the AutoFS daemon executes
the file as a program and passes the key to be located within the
map as an argument. The executable AutoFS map returns a map entry
on the standard output. If they cannot supply a map entry for the
key, they should return nothing. You can list executable AutoFS
maps in the master map or include them in local AutoFS map files.
For example, the following executable map, implemented as
a shell script, emulates the AutoFS built-in -hosts map
for /net. It obtains a list
of exported file systems from an NFS server (its name given as the key
argument), formats the path names into a multiple-mount map entry,
and sorts the list to order the mounts correctly into a top-down hierarchy:
# ! /bin/sh Server=$1 showmount -e $1 | awk ‘{print $1 “\t’$Server’: $1 “\\”} | sort |