Linux/Unix you would use. eg: fuser -c /tmp or lsof could also be used.
I was wondering if there was a perl module that does the same thing. ________________________________ From: David Precious <[email protected]> To: [email protected] Cc: Paul.G <[email protected]> Sent: Thursday, 10 January 2013 8:22 PM Subject: Re: check processes accessing file system On Wed, 9 Jan 2013 17:45:51 -0800 (PST) "Paul.G" <[email protected]> wrote: > Is there a quck way to test if processes are accessing file system in > perl? That's quite a vague requirement. Find out what processes have a specific file open? Find out what processes are doing IO at that specific moment? What is it you actually need to find out? How you do this may be somewhat OS-specific too, and you haven't mentioned what OS you're using. If you're using a Unixy system and want to know what processes have a specific file open, take a look at Unix::Lsof - e.g.: use Unix::Lsof; my ($output,$error) = Unix::Lsof::lsof("afile.txt"); my @pids = keys %$output; (Checking for error is left as an exercise to the reader.) -- David Precious ("bigpresh") <[email protected]> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
