| Name | Size | Mode | Actions |
|---|---|---|---|
| 00MANIFEST | 1807 | 0644 | editdlrm |
| 00README | 2045 | 0644 | editdlrm |
| big_brother.perl5.gz | 2078 | 0644 | editdlrm |
| count_pf.perl | 1849 | 0755 | editdlrm |
| count_pf.perl5 | 2022 | 0755 | editdlrm |
| identd.perl5 | 3304 | 0755 | editdlrm |
| idrlogin.perl.gz | 2222 | 0644 | editdlrm |
| idrlogin.perl5.gz | 2270 | 0644 | editdlrm |
| list_fields.awk.gz | 1764 | 0644 | editdlrm |
| list_fields.perl.gz | 1751 | 0644 | editdlrm |
| list_NULf.perl5.gz | 1836 | 0644 | editdlrm |
| shared.perl5.gz | 3571 | 0644 | editdlrm |
| sort_res.perl5 | 3719 | 0755 | editdlrm |
| watch_a_file.perl | 2235 | 0755 | editdlrm |
| xusers.awk | 3975 | 0755 | editdlrm |
/usr/share/doc/lsof/examples/watch_a_file.perl (2235B)
) { chop; if (/^p(.*)/) { $curpid = $1; next; } # Identify process. if (/^f/) { if ($curpid > 0) { if ($pids eq "") { $pids = $curpid; } else { $pids = $pids . "," . $curpid; } $curpid = -1; } } } close(P); wait; if ($pids eq "") { die "$Pn: no processes using $fnm located.\n"; } print "watch_file: $fnm being used by processes:\n\t$pids\n\n"; # Read repeated lsof output from a pipe and display. $pipe = "$LSOF -ap $pids -r $RPT $fnm"; open(P, "$pipe|") || die "$Pn: can't pipe: $pipe\n"; while (
) { print $_; } close(P); print "$Pn: unexpected EOF from \"$pipe\"\n"; exit 1; ## isexec($path) -- is $path executable # # $path = absolute or relative path to file to test for executabiity. # Paths that begin with neither '/' nor '.' that arent't found as # simple references are also tested with the path prefixes of the # PATH environment variable. sub isexec { my ($path) = @_; my ($i, @P, $PATH); $path =~ s/^\s+|\s+$//g; if ($path eq "") { return(""); } if (($path =~ m#^[\/\.]#)) { if (-x $path) { return($path); } return(""); } $PATH = $ENV{PATH}; @P = split(":", $PATH); for ($i = 0; $i <= $#P; $i++) { if (-x "$P[$i]/$path") { return("$P[$i]/$path"); } } return(""); }