Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Martin Andersson
August 1, 2005, 3:06 pm
rate this thread
I've got a small Perl application that's supposed to run on Solaris
version 8 through 10.
The application basically checks disk usage on home directories using
the the File::Find module.
The problem I've encountered is when scanning automount based NFS home
directories. If the directories aren't mounted before starting the
find() call the function does not seem to traverse the directories.
I tried to implement a work around by issuing a "readdir()" on all of
the folders in "/home" put this does not solved the problem since
find() seem to already have "scanned" these directories.
Is there any way of implementing this? I basically want a Perl based
version of the du command that handles automount / autofs.
Re: File::Find on Solaris v8-10
Martin Andersson wrote:
It's been awhile since I've played with Solaris, so my knowledge is a
bit rusty, but I believe it works the same or similiar to v6.
If they're not mounted, there is nothing for find to traverse. This is
not really a Perl problem. If you cd to /home and do an ls, you also
won't see any directories that are not in use.
That is expected. readdir will only find the active directories as that
is all that are currently mounted (again this is an OS issue).
There are a couple of ways around it.
The easiest is to execute the script from the server that is providing
the automounting. Instead of running on /home, you would run on the
path where they really exist (typically /export/home). The df command
when a home directory is mounted will tell you the server and actual
Another approach would be to extract the home directory names from the
passwd file or NIS server and execute in each one separately (i.e. do
the equivalent of cd /home/user1; find .) By doing that, you'd force an
automount to occur.
- W. Citoan
First say to yourself what you would be; and then do what you have to do.
- » How do you send a custom request with LWP::UserAgent?
- — Previous thread in » PERL Modules Announcements