The automounter has several side effects that cause confusion in both
processes and users that encounter its emulated directories. This
section uncovers some utilities that are disturbed by the
automounter.
9.6.1. Long search paths
If you have many directories listed in
your search path, logging into a
system using the automounter for some of these directories increases
your login time significantly. Instead of listing the directories in
your search path, create "wrappers" for the utilities of
interest and put them in
/usr/local/bin. The
wrappers can set environment variables and execute the appropriate
utility, causing the automounter to mount the necessary filesystem
when you use it instead of when you log in.
For example, you can include Frame 6.0 in your search path in your
.cshrc file:
set path = ( /tools/deskset/frame6.0/bin $path )
If
/tools is managed by the automounter, your
shell causes
/tools/deskset to be mounted when
it builds the command hash table after setting your search path.
Instead of listing all directories in
/tools,
create a wrapper in
/usr/local/bin for the
maker utility in
/tools/deskset/frame6.0/bin so that you
don't have to list any subdirectory of
/tools in your search path:
Wrapper for maker
#!/bin/sh
PATH=/tools/deskset/frame6.0/bin:$PATH
exec /tools/deskset/frame6.0/bin/maker
This wrapper sets the search path as well, so that any executables
invoked by
maker will be able to find related
utilities in its executable directory. By putting this wrapper in
/usr/local/bin, you avoid having to automount
/tools/frame6.0 when you log in. For just a few
directories, the automounter overhead isn't that large, but
with ten or more software packages loaded, logging in becomes a slow
process. Furthermore, not mounting all of these filesystems when you
log in shields you from server
crashes: your workstation will only
hang if one of the servers you're using crashes.
9.6.2. Avoiding automounted filesystems
Utilities run out of
cron, such as nightly
find jobs,
are easily overworked by
the automounter. The solution is to modify
cron
jobs to avoid remote filesystems:
-
Confine cron jobs to run
find on local filesystems.
-
Use an option to find like
-xdev or -mount to force
find to not cross mount points.
This uses the above constraints to implement a script to search for
core files:
mount | grep -v remote | awk ' { print $1 } ' | xargs -i find {} -name 'core*' -
mount | /usr/bin/mailx -s"core file report" joe@eng
The
mount invocation shows what is currently
mounted,
grep filters out anything that
isn't local,
awk prints the first argument
(the mount points),
xargs passes each mount
point to a separate invocation of
find, and
find searches for files starting
with the name
core within the mount point's filesystem.