[EMAIL PROTECTED] wrote:
> Hi all, does any body out here have software that will map afs volumes to
> mount points and make up a little database of it.
> Stan
Hi Stan,
The attached perl script, afsmounts, was posted to info-afs.
--
cheers
paul http://acm.org/~mpb
85% Slashdot pure
#!/usr/local/bin/perl
#
# NAME afsmounts
# AUTHOR Bradley White [EMAIL PROTECTED]
# PURPOSE Display AFS voulme names and mountpoints
# USAGE afsmounts /afs/$afscell
sub descend {
local($dir) = @_;
local(@names);
return warn "$dir: $!\n" unless opendir(DIR, $dir);
@names = readdir(DIR);
closedir(DIR);
for (@names) {
&doname($dir . "/" . $_) unless $_ eq "." || $_ eq "..";
}
return $dir;
}
sub doname {
local($name) = @_;
local($dev, $ino, $vol);
return warn "$name: $!\n" unless ($dev, $ino) = lstat($name);
return &descend($name) if $ino & 1;
return $name if -l $name || ! -d _;
$vol = `fs lsmount $name`;
die unless $vol =~ s/.*mount point for volume '(.*)'\n$/\1/;
printf "%-${volwidth}s %s\n", $vol, $name;
return $name if $vol =~ /.*\.backup$/;
return &descend($name);
}
$volwidth = 24;
printf "%-${volwidth}s %s\n", "Volume Name", "Mounted-on";
foreach (@ARGV ? @ARGV : (".")) {
s#(.)/+$#\1#;
$msg = `fs examine $_ 2>&1`;
$msg =~ s/fs:\s*//, warn($msg), next unless $? == 0;
&doname($_);
}
exit 0