Hey group,
   Hope everyone had a great weekend.  I was working on a perl wrapper
around the lsof command.  On the AIX machines I work on the version of
lsof does not display the file name, only the node.  So I thought I
would write a small wrapper around lsof that does a find on the inode
(with the volume specifically given as a command line option.)
   Anyways, I used find2perl to generate the the relative find code,
but I can't seem to find a way to pass a variable to it.


here is what I mean:


--------------------<relevant
code>------------------------------------

use vars qw/*name *dir *prune/;
*name   = *File::Find::name;
*dir    = *File::Find::dir;
*prune  = *File::Find::prune;


open L, "$lsof $volume |" or die "Cannot open $lsof:$!\n";
    while (<L>){
        if (/^COMMAND/){
            print "COMMAND\tPID\tUSER\tINODE\t\tFILE\n";
        }else{
            my ($command, $pid, $owner, $node) = (split /\s+/)
[0,1,2,7];
            print "$command\t$pid\t$owner\t[$node]\t\t\n";
            my $file = find(\&wanted($node), "$mount");
        }
    }
close (L);

sub wanted {
    my ($node) = @_;
    my ($dev,$ino,$mode,$nlink,$uid,$gid);

    (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && -f _ && ($ino
== $node);

    return $name;
}


 --------------------</relevant
code>------------------------------------


I am not sure what I am missing.  Any help would be appreciated.


Thanks,
Sunckell


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to