File::Find on Solaris v8-10
am 01.08.2005 20:06:06 von Martin Andersson
Hi,
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.
Regards,
Martin Andersson
Re: File::Find on Solaris v8-10
am 04.08.2005 02:35:52 von wcitoan
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.
>
> 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.
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.
> 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.
That is expected. readdir will only find the active directories as that
is all that are currently mounted (again this is an OS issue).
> Is there any way of implementing this? I basically want a Perl based
> version of the du command that handles automount / autofs.
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
directory name.
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.
-- Epictetus