in reply to Check whether a file is open
Will tell you whether /etc/passwd is currently opened by another process, the pid of that process and a whole lot of other useful stuff.lsof /etc/passwd
will give you all open files in a directory.lsof +D /etc
lsof -p 12345
will give you all files opened by the process with the pid 12345.
Apply your favourite variant of backticks or open to examine the output in Perl.
Hmm, given that there's no Perl wrapper module for lsof in CPAN (and Linux::Fuser is Linux-only), maybe it'd be worthwhile writing one?
|
|---|